@@ -42,8 +42,8 @@ that the temporary file resides on the same filesystem.
4242
4343The temporary file will then be atomically moved to the target location: On
4444POSIX, it will use ``rename `` if files should be overwritten, otherwise a
45- combination of ``link `` and ``unlink ``. On Windows, it uses `` MoveFileEx `` (see
46- MSDN _) through stdlib's ``ctypes `` with the appropriate flags.
45+ combination of ``link `` and ``unlink ``. On Windows, it uses MoveFileEx _ through
46+ stdlib's ``ctypes `` with the appropriate flags.
4747
4848Note that with ``link `` and ``unlink ``, there's a timewindow where the file
4949might be available under two entries in the filesystem: The name of the
@@ -53,7 +53,21 @@ Also note that the permissions of the target file may change this way. In some
5353situations a ``chmod `` can be issued without any concurrency problems, but
5454since that is not always the case, this library doesn't do it by itself.
5555
56- .. _MSDN : https://msdn.microsoft.com/en-us/library/windows/desktop/aa365240%28v=vs.85%29.aspx
56+ .. _MoveFileEx : https://msdn.microsoft.com/en-us/library/windows/desktop/aa365240%28v=vs.85%29.aspx
57+
58+ fsync
59+ -----
60+
61+ On POSIX, ``fsync `` is invoked on the temporary file after it is written (to
62+ flush file content and metadata), and on the parent directory after the file is
63+ moved (to flush filename).
64+
65+ ``fsync `` does not take care of disks' internal buffers, but there don't seem
66+ to be any standard POSIX APIs for that. On OS X, ``fcntl `` is used with
67+ ``F_FULLFSYNC `` instead of ``fsync `` for that reason.
68+
69+ On Windows, `_commit <https://msdn.microsoft.com/en-us/library/17618685.aspx >`_
70+ is used, but there are no guarantees about disk internal buffers.
5771
5872Alternatives and Credit
5973=======================
0 commit comments