Re: Mailbox locking
On Wed, Dec 21, 2005 at 02:13:21PM +1100, Brendan O'Dea wrote:
> >> A better option if you need to use fcntl locking is to write an XS
> >> module.
> >I'm amazed that something like this doesn't already exist, [...]
> So was I, although to be frank I can't think of a case where I've ever
> needed partial locking, so flock is more than sufficient. Presumably
> the same is the case for others.
Thanks for all the answers.
In the mbox case, policy requires fcntl(), since that (might) work over
NFS while flock() doesn't. In my understanding, the idea is to do
fcntl() yourself, then use liblockfile to do the dotlocking.
A portable fcntl XS module would of course be the cleanest solution,
but pack('ss@256', F_WRLCK, SEEK_SET) seems OK for the time being.
Perhaps I'll try to make an XS version some day...