Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^3: Trying to understand flock

by aquarium (Curate)
on Nov 14, 2010 at 22:54 UTC ( [id://871376]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Trying to understand flock
in thread Trying to understand flock

i stay away from file locking as much as possible. for the most part it is advisory locking, so you need to write programs that use flock and read/write clode blocks in an atomic way that prevents race conditions or lockup. there's specific ways you are meant to write perl code when using flock, to avoid said lockups..and the code sometimes looks like the martians have landed. the flock perldoc has some of the gory details. Even with all the contrived code, the possibility of deadlock is still real, and hence it's probably better to avoid the situation altogether.
i'm sure some of the higher order perlmonks have memorised the particular idioms/code to use, and can write pretty stable code to share a file. personally i don't think it's best practice to share a file via a locking mechanism.
the hardest line to type correctly is: stty erase ^H

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (6)
As of 2024-04-23 15:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found