On 03/08/2006, at 6:03 PM, John Clarke wrote:

On Thu, Aug 03, 2006 at 05:44:45 +1000, Sam Lawrance wrote:

Could you use something like pthread_cond_timedwait, and wake the
thread up from the signal handler?

That was my first thought too, then I read this in the man page:

    ASYNC-SIGNAL SAFETY
        The condition functions are  not  async-signal  safe,  and
        should not be called from a signal handler. In particular,
        calling pthread_cond_signal or pthread_cond_broadcast from a
        signal handler may deadlock the calling thread.

So no, it's unlikely to work.

OK, how about using a separate thread to sigwait() on the desired signal, and dispatch any work from the thread after the signal is noticed.

_______________________________________________
coders mailing list
[email protected]
http://lists.slug.org.au/listinfo/coders

Reply via email to