[Top][All Lists]

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

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

From: Paul Vixie
Subject: Re: [Nmh-workers] Locking (specifically, sequences)
Date: Mon, 11 Mar 2013 12:33:41 -0700
User-agent: Postbox 3.0.7 (Windows/20130120)

Ken Hornstein wrote:
i propose that
the locking fopen function in the MH library be adapted to be willing to
try the advisory lock three times at one second intervals, on the
assumption that no writer will hold the lock that long and if there's a
convoy then we've got bigger problems. (ideally we'd do a wait-lock in a
thread and kill that thread if it waits too long, but threads would not
be "the MH way".)

I guess I was thinking in my head of the lock completely blocking, but
you think that having a timeout makes more sense?  I'm neutral on that.
There's not a portable way of having a lock timeout other than loop/sleep,
is there?

well, yes, we've done it with fork.

if ((child = fork()) == 0) {
    kill(SIGINT, getppid());
if (child > 0) {
    kill(SIGINBT, child);

so, one of them always has to kill the other, it's just a matter of whether the lock succeeds in time or not. obviously there's error checking missing here, and signal catching. but mostly this is a gigantic performance drainer and should not be done. that's why i proposed a loop and LOCK_NB.

if "the MH way" could expand to C89 and posix threads, we'd have some options that were both performance and correct.


reply via email to

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