Exclusive flock will wait for previous exclusives to release before it will do its thing, i.e. it blocks. We flock on every file read & write, so yes, we are checking.
I've personally rewritten each of what used to be seperate file I/O routines to use what is now only a handful - all of which use the same model:
Verbatim from one of the routines:
open(FILE, ">$path") or die "$! writing $path"; &lock; # calls flock(FLOCK_EX) and logs print FILE $string; &unlock; # calls flock(FLOCK_UN) and logs close FILE;
(Yes, we are using strict... *FILE has been localized. The perils of inheriting someone else's work... :( :( :( )
Further thoughts? Thanks!
In reply to Re: Re: File locking, lock files, and how it all sucks
by tocie
in thread File locking, lock files, and how it all sucks
by tocie
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |