On Wed, 21 Feb 2007, William James wrote:

On 2/21/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:

>> There's no race.  For async signals, system just picks one thread for
>> delivery.
>
>This is bad. Is there no function to define that signals should be
>send to all threads for async signals?

Why?  In what circumstances do all threads need to handle an
asynchronous signal?

To do some work for the signal. Like cleanup for Control-C.

If a thread needs to do cleanup, it should indicate so by enqueuing the cleanup handler via pthread_cleanup_push().

The thread that handles the signal would then simply iterate over every other thread and call pthread_cancel() on them. Strictly speaking, it wouldn't even need to, as the enqueued cleanup handlers will be called on thread exit anyway, and at process exit all threads will also exit.

I mean, just emit some sort of "internal message" (using thread synchronization methods) from within your signal handler on e.g. Ctrl+C and thereby rely it into the usual "exit processing" your application must have anyway ?

FrankH.
_______________________________________________
opensolaris-code mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code

Reply via email to