Message138073
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. |
|
Date |
User |
Action |
Args |
2011-06-10 10:59:18 | vstinner | set | recipients:
+ 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:18 | vstinner | set | messageid: <1307703558.6.0.865064878055.issue8407@psf.upfronthosting.co.za> |
2011-06-10 10:59:18 | vstinner | link | issue8407 messages |
2011-06-10 10:59:17 | vstinner | create | |
|