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

Function _shutdown

Lib/threading.py:1559–1583  ·  view source on GitHub ↗

Wait until the Python thread state of all non-daemon threads get deleted.

()

Source from the content-addressed store, hash-verified

1557_main_thread = _MainThread()
1558
1559def _shutdown():
1560 """
1561 Wait until the Python thread state of all non-daemon threads get deleted.
1562 """
1563 # Obscure: other threads may be waiting to join _main_thread. That's
1564 # dubious, but some code does it. We can't wait for it to be marked as done
1565 # normally - that won't happen until the interpreter is nearly dead. So
1566 # mark it done here.
1567 if _main_thread._os_thread_handle.is_done() and _is_main_interpreter():
1568 # _shutdown() was already called
1569 return
1570
1571 global _SHUTTING_DOWN
1572 _SHUTTING_DOWN = True
1573
1574 # Call registered threading atexit functions before threads are joined.
1575 # Order is reversed, similar to atexit.
1576 for atexit_call in reversed(_threading_atexits):
1577 atexit_call()
1578
1579 if _is_main_interpreter():
1580 _main_thread._os_thread_handle._set_done()
1581
1582 # Wait for all non-daemon threads to exit.
1583 _thread_shutdown()
1584
1585
1586def main_thread():

Callers

nothing calls this directly

Calls 4

reversedFunction · 0.85
_is_main_interpreterFunction · 0.70
is_doneMethod · 0.45
_set_doneMethod · 0.45

Tested by

no test coverage detected