Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 74e7cf3

Browse files
committed
Issue #19850: asyncio: Set SA_RESTART when registering a signal handler to
limit EINTR occurrences.
1 parent 0a956f1 commit 74e7cf3

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

Lib/asyncio/unix_events.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ def add_signal_handler(self, sig, callback, *args):
7474

7575
try:
7676
signal.signal(sig, self._handle_signal)
77+
# Set SA_RESTART to limit EINTR occurrences.
78+
signal.siginterrupt(sig, False)
7779
except OSError as exc:
7880
del self._signal_handlers[sig]
7981
if not self._signal_handlers:

0 commit comments

Comments
 (0)