[docs] [issue29374] Doc bug: signal.sigwait and signal.sigtimedwait do not work outside the Main thread
Petr MOTEJLEK
report at bugs.python.org
Wed Jan 25 12:25:31 EST 2017
New submission from Petr MOTEJLEK:
Hi,
The documentation for signal.signal() clearly states that it is only supposed to be called on MainThread
However, it does not say so for the signal.sigwait() and neither signal.sigtimedwait()
I think this is an error on the documentation side of things (unless I misread it). When either signal.sigwait or signal.sigtimedwait are called outside MainThread, they simply never catch any signals (signal.sigwait blocks indefinitely)
I did not test this on Windows, but on both Linux and OS X the behavior is the same
Consider the below simple code
import signal
import os
def sigwait():
print("Send me a signal, my PID is {p}".format(p=os.getpid()))
print("Got the signal: {i}".format(i=signal.sigwait((signal.SIGUSR1,))))
If sigwait() is called on MainThread and the process receives SIGUSR1, "Got the signal: ..." gets printed. However, calling sigwait in a different thread blocks the thread indefinitely. The behavior is the same with signal.sigtimedwait() as well
----------
assignee: docs at python
components: Documentation
messages: 286269
nosy: docs at python, petr at motejlek.net
priority: normal
severity: normal
status: open
title: Doc bug: signal.sigwait and signal.sigtimedwait do not work outside the Main thread
type: behavior
versions: Python 3.4, Python 3.5, Python 3.6, Python 3.7
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue29374>
_______________________________________
More information about the docs
mailing list