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

Re: singleton lock not reliable

by pidloop (Novice)
on Jul 17, 2021 at 00:54 UTC ( #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? | Other CB clients
Other Users?
Others contemplating the Monastery: (2)
As of 2022-08-18 05:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?