|
From: | Lyndon Nerenberg |
Subject: | Re: [Nmh-workers] Locking (specifically, sequences) |
Date: | Mon, 11 Mar 2013 18:47:25 -0700 (PDT) |
User-agent: | Alpine 2.00 (OSX 1167 2008-08-23) |
if "the MH way" could expand to C89 and posix threads, we'd have some options that were both performance and correct.I think we already assume C89 as a minimum. However, I'm not sure I want to jump off the threads cliff just yet :-/
The cheap hack way out of this is to set up a select() loop, create a pipe(), set a timer, then do the lock. If the alarm fires, write a byte down the pipe from the signal handler which triggers a return from the select(), and a lookup of the returned FD tells you "timeout!"
No, really. --lyndon
[Prev in Thread] | Current Thread | [Next in Thread] |