diff --git a/Lib/asyncio/proactor_events.py b/Lib/asyncio/proactor_events.py index 9b8ae064a8926b..756ef184565f2e 100644 --- a/Lib/asyncio/proactor_events.py +++ b/Lib/asyncio/proactor_events.py @@ -12,6 +12,7 @@ import warnings import signal import collections +import threading from . import base_events from . import constants @@ -627,7 +628,8 @@ def __init__(self, proactor): proactor.set_loop(self) self._make_self_pipe() self_no = self._csock.fileno() - signal.set_wakeup_fd(self_no) + if threading.current_thread() is threading.main_thread(): + signal.set_wakeup_fd(self_no) def _make_socket_transport(self, sock, protocol, waiter=None, extra=None, server=None):