Issue #19850: asyncio: Set SA_RESTART when registering a signal handler to

limit EINTR occurrences.
This commit is contained in:
Charles-François Natali 2013-12-05 22:47:19 +01:00
parent 0a956f1aec
commit 74e7cf3f46
1 changed files with 2 additions and 0 deletions

View File

@ -74,6 +74,8 @@ class _UnixSelectorEventLoop(selector_events.BaseSelectorEventLoop):
try: try:
signal.signal(sig, self._handle_signal) signal.signal(sig, self._handle_signal)
# Set SA_RESTART to limit EINTR occurrences.
signal.siginterrupt(sig, False)
except OSError as exc: except OSError as exc:
del self._signal_handlers[sig] del self._signal_handlers[sig]
if not self._signal_handlers: if not self._signal_handlers: