Re: Question about threads and signals

From: Jamie Lokier (
Date: Fri Jan 17 2003 - 23:49:20 EST

Ulrich Drepper wrote:
> > 2. Is this true of POSIX threads in general, or just Linux?
> Well, the above is what POSIX requires and what I think we've
> implemented. These requirements are essential for programs which do
> much of their work in signal handlers.

So, in a program which uses pthread_create(), a SIGCHLD handler must
either (a) be reentrant, or (b) be unblocked (or installed) in one
thread only.

> Creating more threads which mainly just sit around but can react to
> signals is a valid programming model.

Indeed, as Ingo pointed out, some signals are like poor man's threads,
and that programming model makes that explicit. I like that, because
it means the signal handler can validly do everything normal code can
do, including use mutexes and other locking primitives which may sleep.

(Some other signals are intrinsically thread-local though, such as
SIGSEGV and SIGFPE - they are synchronous exception handlers rather
than asynchronous event handlers).

Thanks for your quick answer,
-- Jamie
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

This archive was generated by hypermail 2b29 : Thu Jan 23 2003 - 22:00:17 EST