[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Atomicity under Windows

From: Branko Čibej <brane_at_xbc.nu>
Date: 2002-06-09 22:54:57 CEST

Greg Hudson wrote:

>Okay, so it looks like one can get portable concurrency atomicity using
>apr_file_lock() (which uses LockFile() on Windows) or with
>apr_file_open() with the APR_EXCL flag (which calls CreateFile() with
>the CREATE_NEW flag on Windows). That's definitely good to know.
>
>Failure atomicity looks harder. There's no APR interface to the
>FILE_FLAG_WRITE_THROUGH create flag; even if this were corrected (and
>I'm not sure if it can be, since there's no Unix analog), I'm not sure
>how much of a gurantee it gives for file operations. And there would
>still be directory operations to worry about.
>
The analogue to fsync is FlushFileBuffers, not FILE_FLAG_WRITE_THROUGH.
The latter makes _all_ writes go straight to the disk, the former just
flushes ditry pages from the file buffers.

I'm not sure about directory operations. You can't open a directory on
Windows like you'd do on Unix (well, you can, but only for
backup/restore purposes, and with the proper privileges enabled). I
think that in the end it depends on what filesystem you're using. With
NTFS, they should be atomic. Using FAT or FAT32 is nonsense, anyway.

-- 
Brane Čibej   <brane_at_xbc.nu>   http://www.xbc.nu/brane/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sun Jun 9 22:55:28 2002

This is an archived mail posted to the Subversion Dev mailing list.