Re: Killing clones (threads)

Andries.Brouwer@cwi.nl
Thu, 14 Aug 1997 23:15:07 +0200 (MET DST)


From almesber@lrc.di.epfl.ch Thu Aug 14 22:26:11 1997

Andries.Brouwer@cwi.nl wrote:
> Werner Almesberger:
>
> : Since POSIX requires that a signal sent to the process is delivered to
> : exactly (*) one thread, ...
>
> Hmm. Reading 3.3.1.2: At the time of [signal] generation,
> a determination shall be made whether the signal has been generated
> for the process or for a specific thread within the process.

Yup, that's also what my copy says. And two paragraphs later, it says:

"Signals generated for the process shall be delivered to or accepted
by exactly one of those threads within the process."

Yes. So either a signal is sent to a thread, or a signal is sent to
an entire process - and then is handled at most once on behalf of this
process, indeed, by one of its threads.

Strictly speaking, a "kill all threads" functionality in kill() violates
POSIX (as kill() should deliver zero or one signal to threads, but never
more than one), but I'm not sure if we really care about this heavily
theoretical argument ...

Oh, we should be very precise. Threads are tricky, and POSIX is very precise.
Fortunately it says:

When a signal is delivered to a thread, if the action of that signal
specifies termination, stop or continue, the entire process shall be
terminated, stopped, or continued, respectively.

Andries