Messages in this thread | | | Date | Sat, 18 Jan 2003 04:49:20 +0000 | From | Jamie Lokier <> | Subject | Re: Question about threads and signals |
| |
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 majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |