Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(83889)

Side by Side Diff: Lib/asyncio/unix_events.py

Issue 21998: asyncio: a new self-pipe should be created in the child process after fork
Patch Set: Created 4 years, 2 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Lib/asyncio/selector_events.py ('k') | Lib/selectors.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 """Selector event loop for Unix with signal handling.""" 1 """Selector event loop for Unix with signal handling."""
2 2
3 import errno 3 import errno
4 import os 4 import os
5 import signal 5 import signal
6 import socket 6 import socket
7 import stat 7 import stat
8 import subprocess 8 import subprocess
9 import sys 9 import sys
10 import threading 10 import threading
(...skipping 29 matching lines...) Expand all
40 40
41 class _UnixSelectorEventLoop(selector_events.BaseSelectorEventLoop): 41 class _UnixSelectorEventLoop(selector_events.BaseSelectorEventLoop):
42 """Unix event loop. 42 """Unix event loop.
43 43
44 Adds signal handling and UNIX Domain Socket support to SelectorEventLoop. 44 Adds signal handling and UNIX Domain Socket support to SelectorEventLoop.
45 """ 45 """
46 46
47 def __init__(self, selector=None): 47 def __init__(self, selector=None):
48 super().__init__(selector) 48 super().__init__(selector)
49 self._signal_handlers = {} 49 self._signal_handlers = {}
50
51 def _at_fork(self):
52 super()._at_fork()
53 self._selector._at_fork()
54 self._close_self_pipe()
55 self._make_self_pipe()
50 56
51 def _socketpair(self): 57 def _socketpair(self):
52 return socket.socketpair() 58 return socket.socketpair()
53 59
54 def close(self): 60 def close(self):
55 super().close() 61 super().close()
56 for sig in list(self._signal_handlers): 62 for sig in list(self._signal_handlers):
57 self.remove_signal_handler(sig) 63 self.remove_signal_handler(sig)
58 64
59 def _process_self_data(self, data): 65 def _process_self_data(self, data):
(...skipping 929 matching lines...) Expand 10 before | Expand all | Expand 10 after
989 995
990 assert watcher is None or isinstance(watcher, AbstractChildWatcher) 996 assert watcher is None or isinstance(watcher, AbstractChildWatcher)
991 997
992 if self._watcher is not None: 998 if self._watcher is not None:
993 self._watcher.close() 999 self._watcher.close()
994 1000
995 self._watcher = watcher 1001 self._watcher = watcher
996 1002
997 SelectorEventLoop = _UnixSelectorEventLoop 1003 SelectorEventLoop = _UnixSelectorEventLoop
998 DefaultEventLoopPolicy = _UnixDefaultEventLoopPolicy 1004 DefaultEventLoopPolicy = _UnixDefaultEventLoopPolicy
OLDNEW
« no previous file with comments | « Lib/asyncio/selector_events.py ('k') | Lib/selectors.py » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+