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

Method _bootstrap

Lib/multiprocessing/process.py:290–333  ·  view source on GitHub ↗
(self, parent_sentinel=None)

Source from the content-addressed store, hash-verified

288 ##
289
290 def _bootstrap(self, parent_sentinel=None):
291 from . import util, context
292 global _current_process, _parent_process, _process_counter, _children
293
294 try:
295 if self._start_method is not None:
296 context._force_start_method(self._start_method)
297 _process_counter = itertools.count(1)
298 _children = set()
299 util._close_stdin()
300 old_process = _current_process
301 _current_process = self
302 _parent_process = _ParentProcess(
303 self._parent_name, self._parent_pid, parent_sentinel)
304 if threading._HAVE_THREAD_NATIVE_ID:
305 threading.main_thread()._set_native_id()
306 try:
307 self._after_fork()
308 finally:
309 # delay finalization of the old process object until after
310 # _run_after_forkers() is executed
311 del old_process
312 util.info('child process calling self.run()')
313 self.run()
314 exitcode = 0
315 except SystemExit as e:
316 if e.code is None:
317 exitcode = 0
318 elif isinstance(e.code, int):
319 exitcode = e.code
320 else:
321 sys.stderr.write(str(e.code) + '\n')
322 exitcode = 1
323 except:
324 exitcode = 1
325 import traceback
326 sys.stderr.write('Process %s:\n' % self.name)
327 traceback.print_exc()
328 finally:
329 threading._shutdown()
330 util.info('process exiting with exitcode %d' % exitcode)
331 util._flush_std_streams()
332
333 return exitcode
334
335 @staticmethod
336 def _after_fork():

Callers 2

_launchMethod · 0.45
_mainFunction · 0.45

Calls 11

_after_forkMethod · 0.95
runMethod · 0.95
setFunction · 0.85
_ParentProcessClass · 0.85
isinstanceFunction · 0.85
strFunction · 0.85
_set_native_idMethod · 0.80
print_excMethod · 0.80
countMethod · 0.45
infoMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected