MCPcopy Index your code
hub / github.com/RustPython/RustPython / fork_thread

Method fork_thread

Lib/test/test_thread.py:232–246  ·  view source on GitHub ↗
(read_fd, write_fd)

Source from the content-addressed store, hash-verified

230 pid = None
231
232 def fork_thread(read_fd, write_fd):
233 nonlocal pid
234
235 # fork in a thread
236 pid = os.fork()
237 if pid:
238 # parent process
239 return
240
241 # child process
242 try:
243 os.close(read_fd)
244 os.write(write_fd, b"OK")
245 finally:
246 os._exit(0)
247
248 with threading_helper.wait_threads_exit():
249 thread.start_new_thread(fork_thread, (self.read_fd, self.write_fd))

Callers

nothing calls this directly

Calls 3

closeMethod · 0.45
writeMethod · 0.45
_exitMethod · 0.45

Tested by

no test coverage detected