Subject: Re: signal handling oddity with pthreads
To: None <M.Drochner@fz-juelich.de>
From: Nathan J. Williams <nathanw@wasabisystems.com>
List: current-users
Date: 08/22/2003 16:36:49
Matthias Drochner <M.Drochner@fz-juelich.de> writes:

> > The signal is blocked in the target thread's mask the first
> > time the signal was delivered and pthread__kill() was called
> 
> Yes, obviously -- but where is that mask set?

The first call to pthread__kill() calls pthread__deliver_signal(),
which adds the signal in question to the target's signal mask at the
same time as it arranges for the handler to be run, since handlers are
supposed to run with that signal blocked (pthread_sig.c line 816).


> > It selects whether the signal is reported to userland as a synchronous
> > (thread-generated) signal or as an async, process-targeted signal
> 
> Hmm - the "code" is that lowlevel traphandling T_* thing which is defined
> in sys/<arch>/include/trap/h usually? In there some mi meaning which
> I missed?

The code is the same value that a signal handler gets passed for
synchronous signals, and can give the reason for a trap (mostly useful
in the case of SIGFPE). The Single Unix Specification gives some
symbols for certain code meanings, but I don't think we're terribly
consistent about using them.

        - Nathan