signal handler priority issue
Daniel Eischen
eischen at vigrid.com
Fri Jun 11 04:37:21 GMT 2004
On Fri, 11 Jun 2004, Daniel Eischen wrote:
>
> It doesn't matter. If a signal is sent to a thread (via pthread_kill())
> and that signal is masked, then the signal is added to the thread's
> pending signals. If it hits sigsuspend() at a later point in time
> and any pending signals are unmasked, then it returns after processing
> those pending signals.
Also be sure that the installed signal action mask is set to
mask out SIGUSR2.
static void
sigusr1_handler(int sig, siginfo_t *info, ucontext_t *ucp)
{
sigset_t mask;
pthread_sigmask(SIG_SETMASK, NULL, &mask);
assert(sigismember(&mask, SIGUSR2) != 0);
sem_post(...);
sigdelset(&mask, SIGUSR2);
sigsuspend(&mask);
}
Also I think you need a handler for SIGUSR2 as well as SIGUSR1.
The default action for both SIGUSR1 and SIGUSR2 is to terminate
the process. You can't set it to SIG_IGN either because that
will prevent the thread from receiving the signal.
--
Dan Eischen
More information about the freebsd-threads
mailing list