From: Jamie Lokier <jamie@shareable.org>
To: Ulrich Drepper <drepper@redhat.com>
Cc: linux-kernel@vger.kernel.org, Ingo Molnar <mingo@elte.hu>
Subject: Re: Question about threads and signals
Date: Sat, 18 Jan 2003 04:49:20 +0000 [thread overview]
Message-ID: <20030118044920.GC18658@bjl1.asuk.net> (raw)
In-Reply-To: <3E28CF26.6020202@redhat.com>
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
prev parent reply other threads:[~2003-01-18 4:40 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-01-18 3:24 Question about threads and signals Jamie Lokier
2003-01-18 3:51 ` Ulrich Drepper
2003-01-18 4:49 ` Jamie Lokier [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20030118044920.GC18658@bjl1.asuk.net \
--to=jamie@shareable.org \
--cc=drepper@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox