Author vstinner
Recipients benjamin.peterson, exarkun, giampaolo.rodola, gregory.p.smith, jcea, loewis, marcin.bachry, neologix, pitrou, python-dev, schmichael, skrah, spiv, tseaver, vstinner
Date 2011-06-10.10:59:17
SpamBayes Score 8.24422e-08
Marked as misclassified No
Message-id <1307703558.6.0.865064878055.issue8407@psf.upfronthosting.co.za>
In-reply-to
Content
neologix> Patch attached.

I wrote a different patch based on your patch. The main change is that I chose to keep signal.alarm(1) instead of sending the signal from the parent process to the child process, because I don't think that time.sleep(0.5) is a reliable synchronization code to wait until the child process is waiting in sigwait().

test_sigwait_thread() uses time.sleep(1) to wait until the main thread is waiting in sigwait(), but it is not mandatory because the signal is already blocked in the thread. I wrote test_sigwait_thread() to ensure that sigwait() releases the GIL, not to check that if a thread raises a signal while sigwait() is waiting, sigwait() does correctly receive it.

We may use time.sleep() in test_sigwait() if the signal is blocked in the parent process before the fork() (and unblocked in the parent process after the fork, but before sending the signal to the child process), but I think that signal.alarm() is more reliable and simple.

--

test_sigwait(_thread) was the last known bug of this issue, so let's close it. Reopen it if you see other bugs in pthread_sigmask(), pthread_kill(), sigpending() and sigwait() functions, or maybe better: open new issues because this issue has a too long history! See issue #12303 for sigwaitinfo() and sigtimedwait(), and issue #12304 for signalfd.
History
Date User Action Args
2011-06-10 10:59:18vstinnersetrecipients: + vstinner, loewis, gregory.p.smith, jcea, spiv, exarkun, tseaver, pitrou, giampaolo.rodola, benjamin.peterson, marcin.bachry, schmichael, skrah, neologix, python-dev
2011-06-10 10:59:18vstinnersetmessageid: <1307703558.6.0.865064878055.issue8407@psf.upfronthosting.co.za>
2011-06-10 10:59:18vstinnerlinkissue8407 messages
2011-06-10 10:59:17vstinnercreate