Jethro Beekman <jethro@xxxxxxxxxxxx> wrote: > Previously, if a lock timeout is specified using `-w`, flock() is called > using LOCK_NB in a loop with a sleep. This results in two issues. > > The first issue is that the process may wait longer than necessary when > the lock becomes available. For this the `-W` option was added, but this > requires fine-tuning. > > The second issue is that if lock contention is high, invocations using > `-w` without a timeout will always win lock acquisition from > invocations that use `-w` *with* a timeout. This is because invocations > using `-w` are actively waiting on the lock whereas the others only > check from time to time whether the lock is free, which will never be > the case. > > This patch removes the `-W` option and the sleep loop. Instead, flock() > is always called in a blocking fashion, but the alarm() function is used > with a non-SA_RESTART signal handler to cancel the system call. Doesn't apply anymore, if you send a rebased version I'll apply it.