This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients bkabrda, vstinner
Date 2014-07-01.10:31:10
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1404210670.35.0.464201719885.issue21895@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2014-07-01 10:31:10vstinnersetrecipients: + vstinner, bkabrda
2014-07-01 10:31:10vstinnersetmessageid: <1404210670.35.0.464201719885.issue21895@psf.upfronthosting.co.za>
2014-07-01 10:31:10vstinnerlinkissue21895 messages
2014-07-01 10:31:10vstinnercreate