[Python-Dev] wait time [was: Ext4 data loss]

Tino Wildenhain tino at wildenhain.de
Thu Mar 12 22:35:48 CET 2009


Jim Jewett wrote:
> On 3/12/09, "Martin v. Löwis" <martin at v.loewis.de> wrote:
>>> It is starting to look as though flush (and close?) should take an
>>> optional wait parameter, to indicate how much re-assurance you're
>>> willing to wait for.
> 
>> Unfortunately, such a thing would be unimplementable on most of today's
>> operating systems.
> 
> What am I missing?
> 
> _file=file
> class file(_file): ...
>     def flush(self, wait=0):
>         super().flush(self)
>         if wait < 0.25:
>             return
>         if wait < 0.5 and os.fdatasync:
>             os.fdatasync(self.fileno())
>             return
>         os.fsync(self.fileno())
>         if wait < 0.75:
>             return
>         if os.ffullsync:
>             os.ffullsync(self.fileno())
> 

What would be wrong with just making the f*sync calls
methods of the file object and that's about it?

alternatively when flush() should get an optional argument,
I'd call it sync and use a set of predefined and meaningful
constants (and no floating point value).

Just my 2ct.

Regards
Tino

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3241 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://mail.python.org/pipermail/python-dev/attachments/20090312/ed79e208/attachment-0001.bin>


More information about the Python-Dev mailing list