Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Question about Flock and die

by converter (Priest)
on Apr 06, 2003 at 00:25 UTC ( #248361=note: print w/ replies, xml ) Need Help??


in reply to Question about Flock and die

What if your open succeeds, but flock fails? You've already created a new lockfile. This probably won't hurt anything if the lockfile is empty, but if you should later decide to write something to the lockfile, a pid for example, you'll have a bug that will probably be very difficult to track down.

dug mentioned File Locking Tricks and Traps (dug++), the Trap #3: Shutting the Barn Door etc. slide explains the problem and the slide that follows shows a better way to open the file.


Comment on Re: Question about Flock and die

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (3)
As of 2015-07-06 00:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (68 votes), past polls