in reply to Re (tilly) 1: File locking, lock files, and how it all sucks
in thread File locking, lock files, and how it all sucks
Also remember that a close loses the lock.I'd like to add to that... you lose the lock if you close any filehandle that has the locked file open. Here's some code to make this clearer:
This took me forever to track down when my DBM files started getting corrupted a while back...open A, "<foo"; flock A, LOCK_SH; open B, "<foo"; close B; # lock on foo is now lost
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re (tilly) 1: File locking, lock files, and how it all sucks
by tocie (Novice) on Aug 22, 2001 at 00:21 UTC |