This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: pthread_kill: signals remain pending after target thread exits

On Oct 22 02:08, John Carey wrote:
> > From: Corinna Vinschen []
> > Sent: Wednesday, October 21, 2015 4:48 AM
> > Subject: Re: pthread_kill: signals remain pending after target thread exits
> ...
> > > On Sep 11 18:11, John Carey wrote:
> > > There seems to be a problem with pthread_kill: a pending signal
> > > targeting a particular thread prevents other threads from receiving
> > > signals sharing the same signal number--even after the original target
> > > thread exits and is joined.
> ...
> > The important thing here is to get rid of the pending signal.
> Yes, I agree that is the most important thing.
> > > In my view it would be desirable if:
> > >
> > >   - Pending signals targeting a particular thread would not outlast
> > >   that thread.
> > 
> > Since you looked into the code anyway, do you have an idea how to
> > implement that?  For a start, do you have a simple testcase, only
> > the bare code needed to reproduce the issue?
> I've attached a test case that I *think* gets into the right spot, at
> least for 64-bit Cygwin 2.0.4.  That is, it hangs trying to receive
> the signal, instead of terminating.  (This test passes (terminates) in
> 32-bit Cygwin 1.7.9 and 64-bit Ubuntu 14.04.3 LTS.)

Thanks for the testcase.  I applied a patch which hopefully works as
desired, at least to fix the immediate problem of the remaining pending
signal when a thread exits.  I uploaded a new developer snapshot to  Please give it a try.

Note that the today's snapshot does *NOT* contain the changes concerning
the new ACL handling, so people testing that stuff should skip this

> > >   - Multiple pending signals targeting different threads could
> > >   coexist, even if they shared the same signal number.  This happens
> > >   on Linux (Ubuntu 14.04.3), where I can generate two signals for two
> > >   different threads, then sleep for a bit in each target thread, and
> > >   finally have each thread receive its signal with sigwait()--neither
> > >   signal is lost during the sleeping period.
> > 
> > That requires to extend the handling for pending signals.  That's
> > a rather bigger task...
> Yeah.  It's nice if threads don't interfere with each other, but this
> part would indeed be harder to change.

I added that to my neverending TODO list.  Maybe I get around to it at
one point.


Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

Attachment: pgpvvRgSH19Ci.pgp
Description: PGP signature

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]