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

Method _stop_locked

Lib/multiprocessing/resource_tracker.py:108–141  ·  view source on GitHub ↗
(
        self,
        close=os.close,
        waitpid=os.waitpid,
        waitstatus_to_exitcode=os.waitstatus_to_exitcode,
    )

Source from the content-addressed store, hash-verified

106 self._lock.release()
107
108 def _stop_locked(
109 self,
110 close=os.close,
111 waitpid=os.waitpid,
112 waitstatus_to_exitcode=os.waitstatus_to_exitcode,
113 ):
114 # This shouldn't happen (it might when called by a finalizer)
115 # so we check for it anyway.
116 if self._lock._recursion_count() > 1:
117 raise self._reentrant_call_error()
118 if self._fd is None:
119 # not running
120 return
121 if self._pid is None:
122 return
123
124 # closing the "alive" file descriptor stops main()
125 close(self._fd)
126 self._fd = None
127
128 try:
129 _, status = waitpid(self._pid, 0)
130 except ChildProcessError:
131 self._pid = None
132 self._exitcode = None
133 return
134
135 self._pid = None
136
137 try:
138 self._exitcode = waitstatus_to_exitcode(status)
139 except ValueError:
140 # os.waitstatus_to_exitcode may raise an exception for invalid values
141 self._exitcode = None
142
143 def getfd(self):
144 self.ensure_running()

Callers 1

_stopMethod · 0.95

Calls 5

_reentrant_call_errorMethod · 0.95
closeFunction · 0.50
waitpidFunction · 0.50
waitstatus_to_exitcodeFunction · 0.50
_recursion_countMethod · 0.45

Tested by

no test coverage detected