Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 11 Jun 2004 00:37:16 -0400 (EDT)
From:      Daniel Eischen <eischen@vigrid.com>
To:        Sean McNeil <sean@mcneil.com>
Cc:        freebsd-threads@freebsd.org
Subject:   Re: signal handler priority issue
Message-ID:  <Pine.GSO.4.10.10406110022040.27129-100000@pcnet5.pcnet.com>
In-Reply-To: <Pine.GSO.4.10.10406102337270.18456-100000@pcnet5.pcnet.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.GSO.4.10.10406110022040.27129-100000>