Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Re: Mysterious Disapperance of file contents

by bobn (Chaplain)
on Aug 28, 2003 at 22:45 UTC ( #287576=note: print w/replies, xml ) Need Help??


in reply to Re: Mysterious Disapperance of file contents
in thread Mysterious Disapperance of file contents

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.com

All code given here is UNTESTED unless otherwise stated.

  • Comment on Re: Re: Mysterious Disapperance of file contents

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://287576]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (5)
As of 2020-05-31 04:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    If programming languages were movie genres, Perl would be:















    Results (173 votes). Check out past polls.

    Notices?