Quote:> > There may be a basic misunderstanding on the part of the OP as to how a
> > POSIX thread can be terminated. It can be cancelled or it can exit.
> > A thread can't be terminated by a signal, even if the signal is directed
> to
> > the thread and not to the process. Any such signal would terminate the
> > entire process.
> Yes I know that signals are delivered to all the threads and the scheduler
> will select the particular thread, if the thread has not blocked the
signal.
> There a few cases which I want to clarify
> 1) Are there any extreme cases like single event upsets or some Byzantine
> cases where only one thread can fail?
I would say that there are no such cases in the standard, but a defective
implementation is free to do anything it likes. I don't think this needs to
be programmed for.
Quote:> 2)If a maskable signal such as SIGINT is delivered to the process and all
> but one thread blocks the signal what is the behavior? Does the whole
> process get killed even though the other threads blocked the signal?
Yes. The specification doesn't allow terminate, stop, continue, or ignore to
affect only one thread. Actually, ALL actions are for the process as a
whole. There is no pthread_sigaction function, and sigaction takes no
thread-ID argument.
The only reason why a caught signal appears to affect only one thread is
just that it gets caught only once (per occurrence), and the handler has to
execute someplace.
--Marc