in reply to singleton lock not reliable
You are trying to obtain an exclusive lock on a filehandle that you've opened for reading. I am no expert on file locking but I don't think that's possible. The FAQ is explicit is stating that the filehandle must be opened for writing (or appending or read+write) when using lockf at least. Perhaps that is the cause of your problem. The canonical example in the Monastery is Highlander - allow only one invocation at a time of an expensive CGI script and that also uses a writing filehandle.
I suggest you try switching to a writing filehandle (obviously not on $0) and see if that enables the lock for you reliably across your various OSes.
🦛
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: singleton lock not reliable
by LanX (Saint) on Jun 24, 2021 at 09:51 UTC | |
Re^2: singleton lock not reliable
by ikegami (Patriarch) on Jun 24, 2021 at 04:24 UTC |
In Section
Seekers of Perl Wisdom