Skip to main content

Module runtime

Module runtime 

Source

Enums§

GilSite
A sanctioned GIL acquisition operation, identifying why a monarch_with_gil/monarch_with_gil_blocking site takes the GIL. Each variant names one distinct operation so is_control_plane_allowed can classify it. There is deliberately no catch-all: a new GIL site must add a variant and classify it, or the code will not compile.

Functions§

force_unsanctioned_gil_on_control_plane
Force one unsanctioned control-plane GIL acquisition and count it, for the negative fitness test. Runs on a freshly ControlPlane-tagged thread and routes through check_gil_site so the real gating is exercised; the debug-build debug_assert panic is swallowed so the increment sticks (in release builds there is no assert and the counter bumps directly).
future_into_py
get_gil_on_control_plane
Number of unsanctioned GIL acquisitions seen on the control-plane runtime. For tests; see GIL_ON_CONTROL_PLANE.
get_tokio_runtime
initialize
is_main_thread
Returns true if the current thread is the main Python thread. Compares the current thread’s native ID against the main Python thread’s native ID.
monarch_with_gil
Async wrapper around Python::attach intended for async call sites.
monarch_with_gil_blocking
Blocking wrapper around Python::with_gil for use in synchronous contexts.
register_python_bindings
Initialize the runtime module and expose Python functions
reset_gil_on_control_plane
Reset the unsanctioned control-plane GIL counter to zero. For tests.
shutdown_tokio_runtime
atexit handler that tears down the data-plane runtimes and the global Tokio runtime.
signal_safe_block_on
Block the current thread on a future, but make sure to check for signals originating from the Python signal handler.
sleep_indefinitely_for_unit_tests
A test function that sleeps indefinitely in a loop. This is used for testing signal handling in signal_safe_block_on. The function will sleep forever until interrupted by a signal.