Author vstinner
Recipients bkabrda, vstinner
Date 2014-07-01.10:31:10
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
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.
Date User Action Args
2014-07-01 10:31:10vstinnersetrecipients: + vstinner, bkabrda
2014-07-01 10:31:10vstinnersetmessageid: <>
2014-07-01 10:31:10vstinnerlinkissue21895 messages
2014-07-01 10:31:10vstinnercreate