mirror of
https://github.com/python/cpython.git
synced 2025-08-15 22:30:42 +00:00
bpo-34679: Restore instantiation Windows IOCP event loop from non-main thread (GH-15492)
* Restore running proactor event loop from non-main thread
Co-Authored-By: Kyle Stanley <aeros167@gmail.com>
(cherry picked from commit 1c06009986
)
Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
This commit is contained in:
parent
522a394a72
commit
69d22b8fee
3 changed files with 24 additions and 1 deletions
|
@ -11,6 +11,7 @@ import os
|
|||
import socket
|
||||
import warnings
|
||||
import signal
|
||||
import threading
|
||||
import collections
|
||||
|
||||
from . import base_events
|
||||
|
@ -627,7 +628,9 @@ class BaseProactorEventLoop(base_events.BaseEventLoop):
|
|||
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():
|
||||
# wakeup fd can only be installed to a file descriptor from the main thread
|
||||
signal.set_wakeup_fd(self_no)
|
||||
|
||||
def _make_socket_transport(self, sock, protocol, waiter=None,
|
||||
extra=None, server=None):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue