From 7fe03843a4f6f88d922a5f07056924ec187c778b Mon Sep 17 00:00:00 2001 From: Kyle Stanley Date: Sat, 24 Aug 2019 17:33:57 -0400 Subject: [PATCH] Add conditional to BaseProactorEventLoop init --- Lib/asyncio/proactor_events.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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):