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 (Parson)
on Dec 13, 2012 at 15:37 UTC ( #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


Comment on Re: flock on Windows : process killed while in critical region
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (6)
As of 2014-12-21 02:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (101 votes), past polls