Charles-François Natali <neolo...@free.fr> added the comment: > If you want atomicity to apply to logging, > you must instead guarantee the durability of each write() call, meaning > calling fsync() on each logging call
Why so? There's no point in calling fsync() after each write, since data is written to a temporary file which won't be visible before rename(): even if you call fsync() after each write, if the file is not properly closed, it won't be committed (i.e.renamed). You just need to call fsync() once before closing the file, and then rename it, to ensure that the committed file version is consistent. In the meantime, you could do whatever you want with the stream (the hypothetical AtomicFile): seek(), read(), etc. I'm not sure many methods besides write will be useful, but for example one could easily imagine that the library expects the passed object to have a fileno() method. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue8604> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com