MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / _register_atexit

Function _register_atexit

tools/python-3.11.9-amd64/Lib/threading.py:1516–1530  ·  view source on GitHub ↗

CPython internal: register *func* to be called before joining threads. The registered *func* is called with its arguments just before all non-daemon threads are joined in `_shutdown()`. It provides a similar purpose to `atexit.register()`, but its functions are called prior to

(func, *arg, **kwargs)

Source from the content-addressed store, hash-verified

1514_SHUTTING_DOWN = False
1515
1516def _register_atexit(func, *arg, **kwargs):
1517 """CPython internal: register *func* to be called before joining threads.
1518
1519 The registered *func* is called with its arguments just before all
1520 non-daemon threads are joined in `_shutdown()`. It provides a similar
1521 purpose to `atexit.register()`, but its functions are called prior to
1522 threading shutdown instead of interpreter shutdown.
1523
1524 For similarity to atexit, the registered functions are called in reverse.
1525 """
1526 if _SHUTTING_DOWN:
1527 raise RuntimeError("can't register atexit after shutdown")
1528
1529 call = functools.partial(func, *arg, **kwargs)
1530 _threading_atexits.append(call)
1531
1532
1533from _thread import stack_size

Callers

nothing calls this directly

Calls 2

partialMethod · 0.80
appendMethod · 0.45

Tested by

no test coverage detected