STINNER Victor <victor.stin...@haypocalc.com> added the comment:

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.

----------
resolution:  -> fixed
status: open -> closed

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue8407>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to