Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: flock on Windows : process killed while in critical region

by flexvault (Monsignor)
on Dec 13, 2012 at 15:37 UTC ( [id://1008678]=note: print w/replies, xml ) Need Help??


in reply to flock on Windows : process killed while in critical region

Hello rovf,

I believe the unlock is optional in your code. Closing the file automatically frees the lock. So if a script were to die during the critical code, then the lock would be freed as part of closing all files by Perl.

######################### # CRITICAL REGION IS HERE ######################### flock(LOCKFILE, LOCK_UN); ## optional close(LOCKFILE);

I did a 'super-search' and found this quote but not the slides that are mentioned. "...Check out the links to Dominus' File Locking Tricks and Traps slides in the Question about Flock and die thread for more details..." by converter.

For several years, I would go through the slides again, since 'flock' is very powerful and easy to forget all the "tricks" that can be used. My bookmark didn't work, so maybe the slides have been moved.

Have a good one...Ed

"Well done is better than well said." - Benjamin Franklin

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (1)
As of 2024-04-25 03:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found