Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: singleton lock not reliable

by pidloop (Novice)
on Jul 17, 2021 at 00:54 UTC ( [id://11135087]=note: print w/replies, xml ) Need Help??


in reply to singleton lock not reliable

Many thanks to all who took the time to respond. Key seems to be using a writable lock file. The following version has been running over a month with no dups so I'll call it good.
# only one of us my $LOCKFN = "/tmp/x.mylock"; open my $LF, '>', $LOCKFN or die "Can not create $LOCKFN: $!"; flock ($LF, LOCK_EX | LOCK_NB) or exit;

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (3)
As of 2024-04-16 10:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found