[Python-ideas] Atomic file.get(offset, length)

Matt Chaput matt at whoosh.ca
Sat Jul 21 20:59:52 CEST 2012


I wish Python binary file objects had an atomic seek-read method, so I wouldn't have to perform my own locking everywhere to prevent other threads from moving the file pointer between seek and read. Is this something that can be bubbled up from the underlying platform? I think the Linux C equivalent is pread. I also think Java has something like this but can't find a reference now.

Or does this exist and I missed it? (On a mmap file this is trivial, of course.) Has this been discussed before?

Cheers,

Matt




More information about the Python-ideas mailing list