Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 01 Oct 2009 15:53:34 +0300
From:      Andriy Gapon <avg@icyb.net.ua>
To:        Justin Teller <justin.teller@gmail.com>
Cc:        freebsd-current@freebsd.org
Subject:   Re: Signals and an exiting thread
Message-ID:  <4AC4A64E.7060201@icyb.net.ua>
In-Reply-To: <c47019cc0909301102y189a0b8aq47d23efae549f4ab@mail.gmail.com>
References:  <c47019cc0909301102y189a0b8aq47d23efae549f4ab@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
on 30/09/2009 21:02 Justin Teller said the following:
> We're trying to control one process from another process through
> signals (I know, revolutionary ;-), and we've found that a signal
> occasionally gets lost.  The process we're signaling is
> multi-threaded.  It looks like the signal is lost when the kernel
> decides to post the signal to a thread that is in the process of dying
> (calling pthread_exit, etc).
> 
> Is this expected behavior that we should just handle, or is it a race
> in the kernel that should be/will be/already is fixed?
> 
> It may be that a fix is already in current, and I just haven't found
> it in my searches through the source code (I'm working off of source
> code for an older 8.0 image).  If it is fixed, I'd appreciate a
> pointer to the code that fixes it.
> 
> Thanks in advance for the help

Do you allow all/arbitrary threads to catch signals?
not sure if the following applies to your case, but for multi-threaded
applications we usually designate a dedicated signal handling thread.
sigwait(2), pthread_sigmask(2), etc

-- 
Andriy Gapon



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4AC4A64E.7060201>