STINNER Victor added the comment:

First of all, signals and threads usually don't play together. Most signal 
functions are *not* thread safe. The behaviour of signal functions are not well 
defined for threads.

Example with pause:

"pause()  causes  the  calling  process  (or  thread) to sleep until a signal 
is delivered that either terminates the process or causes the invocation of a 
signal-catching function."

What does it mean "or thread"? Sometimes the function waits for a signal from 
any thread, something only from the caller thread? :-p

I understood that pause() only waits for signals received in the caller thread, 
main thread in your case.

Depending on the platform, a signal may be delivered to a different thread :-/ 
Especially when a signal is send to the process, ex: "kill -USR1 pid" command 
on UNIX.

This issue is more a documentation issue: we should mention that pause() is 
limited to a thread.

Python signal handlers are only called from the main thread, even if signals 
can be received from any thread.

For your example, you can workaround pause() issue by calling 
"signal.pthread_sigmask(signal.SIG_BLOCK, [signal.SIGCHLD])" in your thread.

----------

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

Reply via email to