nmh-workers
[Top] [All Lists]

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

2013-03-07 20:17:47

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
_______________________________________________
Nmh-workers mailing list
Nmh-workers(_at_)nongnu(_dot_)org
https://lists.nongnu.org/mailman/listinfo/nmh-workers

<Prev in Thread] Current Thread [Next in Thread>