in reply to mutual exclusion and file locking on windows

flock works great on Windows, as long as all programs accessing the file also use flock. Activestate simulates flock on Windows. The only problem you will have with flock is if you access the file outside of perl, or don't call flock in one of your scripts (perl won't check to see if the file is locked unless you call flock at some point).
  • Comment on Re: mutual exclusion and file locking on windows

Replies are listed 'Best First'.
(tye)Re: mutual exclusion and file locking on windows
by tye (Sage) on Aug 08, 2001 at 02:09 UTC

    Actually, under Windows (well, WinNT/Win2K), flock is mandatory unlike under Unix where it is advisory. This means that flock()ing a file prevents any other file handle (even from within the same process) from accessing the file. So you don't need the other programs to also use flock like you would under Unix. Not that this is really an improvement, just another difference to worry about (and a disadvantage in some cases).

            - tye (but my friends call me "Tye")