in reply to Re: File locking, lock files, and how it all sucks
in thread File locking, lock files, and how it all sucks
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!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: File locking, lock files, and how it all sucks
by dws (Chancellor) on Aug 22, 2001 at 01:16 UTC |