MCPcopy Index your code
hub / github.com/python/cpython / detach

Method detach

Lib/multiprocessing/reduction.py:121–135  ·  view source on GitHub ↗

Get the handle. This should only be called once.

(self)

Source from the content-addressed store, hash-verified

119 self._pid = pid
120
121 def detach(self):
122 '''Get the handle. This should only be called once.'''
123 # retrieve handle from process which currently owns it
124 if self._pid == os.getpid():
125 # The handle has already been duplicated for this process.
126 return self._handle
127 # We must steal the handle from the process whose pid is self._pid.
128 proc = _winapi.OpenProcess(_winapi.PROCESS_DUP_HANDLE, False,
129 self._pid)
130 try:
131 return _winapi.DuplicateHandle(
132 proc, self._handle, _winapi.GetCurrentProcess(),
133 self._access, False, _winapi.DUPLICATE_CLOSE_SOURCE)
134 finally:
135 _winapi.CloseHandle(proc)
136
137else:
138 # Unix

Callers 8

recv_handleFunction · 0.45
_rebuild_socketFunction · 0.45
PipeFunction · 0.45
acceptMethod · 0.45
SocketClientFunction · 0.45
rebuild_connectionFunction · 0.45
rebuild_pipe_connectionFunction · 0.45
rebuild_arenaFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected