From 74e7cf3f4664204927b2bd3dd9facc2ac7649715 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charles-Fran=C3=A7ois=20Natali?= Date: Thu, 5 Dec 2013 22:47:19 +0100 Subject: [PATCH] Issue #19850: asyncio: Set SA_RESTART when registering a signal handler to limit EINTR occurrences. --- Lib/asyncio/unix_events.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Lib/asyncio/unix_events.py b/Lib/asyncio/unix_events.py index b611efd17d1..eb3fb9f91c0 100644 --- a/Lib/asyncio/unix_events.py +++ b/Lib/asyncio/unix_events.py @@ -74,6 +74,8 @@ class _UnixSelectorEventLoop(selector_events.BaseSelectorEventLoop): try: signal.signal(sig, self._handle_signal) + # Set SA_RESTART to limit EINTR occurrences. + signal.siginterrupt(sig, False) except OSError as exc: del self._signal_handlers[sig] if not self._signal_handlers: