Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Re^2: singleton lock not reliable

by LanX (Sage)
on Jun 24, 2021 at 09:51 UTC ( #11134250=note: print w/replies, xml ) Need Help??

in reply to Re: singleton lock not reliable
in thread singleton lock not reliable

> The FAQ is explicit is stating that the filehandle must be opened for writing (or appending or read+write)

it depends on the implementation, the perldocs refer to multiple different OS functions potentially used for flock and say

lockf(3) does not provide shared locking, and requires that the filehandle be open for writing (or appending, or read/writing).

So yes, it's possible that some Perl ports will fail when opening with < , if Perl was compiled to use lockf

Personally I'm doing it deliberately on WIN (where it works) to make sure my colleagues understand that the lockfile is an empty semaphore only. (Opening for writing with > has it's own hazards, because the content will be deleted each time.)

It really depends on the OS and FS and should be tested for each combination.

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (5)
As of 2022-08-08 10:44 GMT
Find Nodes?
    Voting Booth?

    No recent polls found