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

Method _do_waitpid

Lib/asyncio/unix_events.py:927–951  ·  view source on GitHub ↗
(self, loop, expected_pid, callback, args)

Source from the content-addressed store, hash-verified

925 thread.start()
926
927 def _do_waitpid(self, loop, expected_pid, callback, args):
928 assert expected_pid > 0
929
930 try:
931 pid, status = os.waitpid(expected_pid, 0)
932 except ChildProcessError:
933 # The child process is already reaped
934 # (may happen if waitpid() is called elsewhere).
935 pid = expected_pid
936 returncode = 255
937 logger.warning(
938 "Unknown child process pid %d, will report returncode 255",
939 pid)
940 else:
941 returncode = waitstatus_to_exitcode(status)
942 if loop.get_debug():
943 logger.debug('process %s exited with returncode %s',
944 expected_pid, returncode)
945
946 if loop.is_closed():
947 logger.warning("Loop %r that handles pid %r is closed", loop, pid)
948 else:
949 loop.call_soon_threadsafe(callback, pid, returncode, *args)
950
951 self._threads.pop(expected_pid)
952
953def can_use_pidfd():
954 if not hasattr(os, 'pidfd_open'):

Callers

nothing calls this directly

Calls 7

waitstatus_to_exitcodeFunction · 0.85
warningMethod · 0.45
get_debugMethod · 0.45
debugMethod · 0.45
is_closedMethod · 0.45
call_soon_threadsafeMethod · 0.45
popMethod · 0.45

Tested by

no test coverage detected