This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: 1.7.0: question about signal delivery to pthreads
- From: Christopher Faylor <cgf-use-the-mailinglist-please at cygwin dot com>
- To: cygwin at cygwin dot com
- Date: Mon, 7 Dec 2009 11:35:47 -0500
- Subject: Re: 1.7.0: question about signal delivery to pthreads
- References: <4B1D2338.2050509@cell-active.com>
- Reply-to: cygwin at cygwin dot com
On Mon, Dec 07, 2009 at 04:46:00PM +0100, Karsten Otto wrote:
>Hi everybody!
>
>I have a question regarding the delivery of signals to pthreads in
>Cygwin (1.7 beta). As an example, please consider the following
>situation (see attached file for source code):
>
>There are two threads, a main thread and another one created by the main
>thread.
>The main registers a SIGALRM signal handler (sigaction), creates the
>other thread (pthread_create), blocks all signals (pthread_sigmask),
>then waits for a SIGHUP (sigwait) before joining the other thread
>(pthread_join).
>The other thread unblocks all signals (pthread_sigmask), then schedules
>an alarm (alarm(1)) and goes to sleep (sleep(5)).
>
>In this situation, I had expected the other thread to receive the
>SIGALRM, and to wake up from sleep consequently; at least it did in
>Linux (2.6.31). However, in Cygwin the signal never arrives, the thread
>sleeps the full turn.
>
>It seems the signal gets delivered to the blocked main thread instead,
>but attempting to check (sigpending) results in a segmentation fault
>(SEGV) for some reason.
>
>If I explictly remove the SIGALRM from the block mask, the signal
>handler gets called and sigpending works, but of course this interrupts
>sigwait (errno=EINTR), hence this is not a viable workaround for me.
>
>So, is cygwin behaving correctly here (in a POSIX sense), or is this a
>bug? Please help me understand.
I can't check this right now but I will when I get back to a convenient
windows system.
If it is a cygwin bug it is not likely to be fixed for a while since
the official release of Cygwin 1.7 is imminent. So it will have to wait
for 1.7.2.
cgf
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple