laziness, impatience, and hubris | |
PerlMonks |
Re: Re: Mysterious Disapperance of file contentsby bobn (Chaplain) |
on Aug 29, 2003 at 02:45 UTC ( [id://287576]=note: print w/replies, xml ) | Need Help?? |
That was my first thought, (hence my award-winning post above), but after reading the doc on flock, it appears that purpose of the flock isn't to stop the second program from opening the file - instead it stops the second program from obtaining the lock - the second program's flock(HANDLE, LOCK_EX) blocks until the first program issues flock(HANDLE, LOCK_UN). The doc on flock shows a sequence much like that used by the OP, but without use of a spearate seamphore file. Testing things very similar to the OP's code seems to work as expected. I don't see the issue. --Bob Niederman, http://bob-n.comAll code given here is UNTESTED unless otherwise stated.
In Section
Seekers of Perl Wisdom
|
|