Open songzhi opened 4 years ago
I'd be willing to work on this (at least for linux), I need it for a project. Would it be possible to get some guidance on how to properly implement this?
I do have a question about this feature though: would this allow one to make multiple read_at
,write_at
calls in parallel? Or is this, on the kernel level, still a sync operation? Even if the offsets do not collide with each other?
@mainrs See this docs for pread(2)/pwrite(2):
The pread() and pwrite() system calls are especially useful in multithreaded applications. They allow multiple threads to perform I/O on the same file descriptor without being affected by changes to the file offset by other threads.
Unix
FileExt
and WindowsFileExt
. They are useful when using.read_at(buf, offset)
instead of.seek(pos); .read(buf)
. Because it callspread(2)
instead oflseek(2)
+read(2)
which is more efficient.