nmh-workers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Nmh-workers] Locking (specifically, sequences)


From: Lyndon Nerenberg
Subject: Re: [Nmh-workers] Locking (specifically, sequences)
Date: Thu, 7 Mar 2013 18:17:21 -0800

On 2013-03-07, at 10:42 AM, Ken Hornstein wrote:

> That the default should be "flock".  The more I research it ... the more
> confused I've become.  fcntl() locks have the unhappy behaviour (as
> Lyndon notes) that any close of a descriptor holding a fcntl() lock
> will remove the lock (even if there are other descriptors open that
> for the same lock).  lockf() does record locking, but cannot do a shared
> lock.  flock() is not part of POSIX, but it seems like everyone that I
> checked supports it.

The sad but inevitable facts of life say you have to implement fcntl() locking 
for POSIX portability, but should defer to anything else if you know the system 
supports it.  This means flock() is the de facto on UNIX. Wrap it all up in 
mh_lock() or something similar and Robert is your father's brother.

--lyndon


reply via email to

[Prev in Thread] Current Thread [Next in Thread]