file locking primitive

Andreas Raab andreas.raab at gmx.de
Sat Jan 3 17:24:46 UTC 2004


> I reviewed some previous email (on and off list), and here are some
possibly
> helpful clippings:
[snip]
> >From Todd Blanchard:
>   On Friday, March 14, 2003, at 11:10  AM, Cees de Groot wrote:
>   > Now, I want to enhance the file plugin with a locking primitive. Are
>   > the posix lockf() semantics available on all the platforms?
>
>   Definitely not on Windows.  You will need to come up with a different
>   lock strategy not dependent on the file system.  I ran into this while
>   trying to use file locks to sync separate java processes.  There is no
>   atomic createAndLockFile on Windows.

This statement seems wrong from what I can tell. Both CreateFile
(http://msdn.microsoft.com/library/en-us/fileio/base/createfile.asp) as well
as LockFile
(http://msdn.microsoft.com/library/en-us/fileio/base/lockfile.asp) provide
various ways of locking files. Whether those are supported on all of the
various file systems is a different matter but one that cannot be possibly
addressed by such a primitive.

Cheers,
  - Andreas




More information about the Squeak-dev mailing list