lkml.org 
[lkml]   [1998]   [Jan]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: 2.2: TaskID's for CLONE_PID? Proper signal handling?
Date
> Synchronous signals (e.g. SIGFPE, SIGILL, etc.) are sent to the
> thread that caused them.
>
> Directed signals (such as delivered by pthread_kill are delivered to
> the identified thread.

This is as per POSIX, yes.

> Asynchronous signals (e.g. SIGINT, the real-time signals. etc.) are
> sent to an arbitrary thread that doesn't have the signal blocked. If
> all threads have the signal blocked, and a thread is executing
> sigwait (or sigwaitinfo), it is delivered via this mechanism.

Actually, sigwait unblocks the signals it is waiting for, so you don't
have to make a special case for it.

If all threads have the signal blocked, you need to queue the signal
on a process-wide basis, and deliver it later to the first thread that
unblocks the signal.

> In the programming environment which I worked in previously
> (LynxOS), this type of signal behavior made it easy to implement the
> main thread as the "signal handling thread" in a completely
> synchronous manner using sigwaitinfo. Thus, some applications could
> have a signal handling thread, a GUI thread, and an "intense
> processing"" thread.

Agreed, this is one of the most reasonable ways to handle signals in a
multi-threaded application.

- Xavier Leroy

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