in reply to Semaphore puzzle
The race condition is not that the second process doesn't detect the creation. It in fact runs the check before the first process has created the semaphore, but after it checked its existence (and didn't find it). You need to create the semaphore right ahead, if the creation failed, you know you are the second one.
map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Semaphore puzzle
by jerryhone (Sexton) on Feb 23, 2021 at 09:00 UTC | |
by jeffenstein (Hermit) on Feb 23, 2021 at 10:35 UTC | |
by jerryhone (Sexton) on Feb 23, 2021 at 17:16 UTC |
In Section
Seekers of Perl Wisdom