lkml.org 
[lkml]   [2003]   [Jan]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: 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/

\
 
 \ /
  Last update: 2005-03-22 13:32    [W:0.035 / U:3.264 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site