Message222022
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:10 | vstinner | set | recipients:
+ vstinner, bkabrda |
2014-07-01 10:31:10 | vstinner | set | messageid: <1404210670.35.0.464201719885.issue21895@psf.upfronthosting.co.za> |
2014-07-01 10:31:10 | vstinner | link | issue21895 messages |
2014-07-01 10:31:10 | vstinner | create | |
|