Antoine Pitrou <[email protected]> added the comment:
Python just exposes thin wrappers around the underlying libc calls, so you have
to understand how those work.
On Linux, the sigwaitinfo() man page says:
NOTES
In normal usage, the calling program blocks the signals in
set via a prior call to sigprocmask(2) (so that the default
disposition for these signals does not occur if they become
pending between successive calls to sigwaitinfo() or sig‐
timedwait()) and does not establish handlers for these sig‐
nals.
So you need to block the given signal with pthread_sigmask() before waiting on
it. For example:
>>> import signal
>>> signal.pthread_sigmask(signal.SIG_BLOCK, [signal.SIGHUP])
set()
>>> signal.sigwait([signal.SIGHUP])
<Signals.SIGHUP: 1>
----------
nosy: +pitrou
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue38284>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com