Issue #8407, issue #11859: Add signal.pthread_sigmask() function to fetch
and/or change the signal mask of the calling thread.
Fix also tests of test_io using threads and an alarm: use pthread_sigmask() to
ensure that the SIGALRM signal is received by the main thread.
Original patch written by Jean-Paul Calderone.
diff --git a/Lib/test/test_io.py b/Lib/test/test_io.py
index 1821492..8d293d0 100644
--- a/Lib/test/test_io.py
+++ b/Lib/test/test_io.py
@@ -2627,6 +2627,8 @@
in the latter."""
read_results = []
def _read():
+ if hasattr(signal, 'pthread_sigmask'):
+ signal.pthread_sigmask(signal.SIG_BLOCK, [signal.SIGALRM])
s = os.read(r, 1)
read_results.append(s)
t = threading.Thread(target=_read)