mirror of
https://github.com/python/cpython.git
synced 2025-08-27 12:16:04 +00:00
parent
024ac542d7
commit
191708c56c
3 changed files with 110 additions and 0 deletions
|
@ -13,6 +13,7 @@ __all__ = (
|
|||
|
||||
import contextvars
|
||||
import os
|
||||
import signal
|
||||
import socket
|
||||
import subprocess
|
||||
import sys
|
||||
|
@ -842,3 +843,13 @@ else:
|
|||
_c_get_running_loop = get_running_loop
|
||||
_c_get_event_loop = get_event_loop
|
||||
_c__get_event_loop = _get_event_loop
|
||||
|
||||
|
||||
if hasattr(os, 'fork'):
|
||||
def on_fork():
|
||||
# Reset the loop and wakeupfd in the forked child process.
|
||||
if _event_loop_policy is not None:
|
||||
_event_loop_policy._local = BaseDefaultEventLoopPolicy._Local()
|
||||
signal.set_wakeup_fd(-1)
|
||||
|
||||
os.register_at_fork(after_in_child=on_fork)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue