pyo3

Module gil

Source
Expand description

Interaction with Python’s global interpreter lock

Structs§

LockGIL πŸ”’
Used to lock safe access to the GIL
ReferencePool πŸ”’ Non-pyo3_disable_reference_pool
Thread-safe storage for objects which were dec_ref while the GIL was not held.
SuspendGIL πŸ”’
A guard which can be used to temporarily release the GIL and restore on Drop.

Enums§

GILGuard πŸ”’
RAII type that represents the Global Interpreter Lock acquisition.

Constants§

GIL_COUNT πŸ”’
This is an internal counter in pyo3 monitoring whether this thread has the GIL.
GIL_LOCKED_DURING_TRAVERSE πŸ”’

Statics§

POOL πŸ”’ Non-pyo3_disable_reference_pool
START πŸ”’

Functions§

decrement_gil_count πŸ”’
Decrements pyo3’s internal GIL count - to be called whenever GILPool or GILGuard is dropped.
gil_is_acquired πŸ”’
Checks whether the GIL is acquired.
increment_gil_count πŸ”’
Increments pyo3’s internal GIL count - to be called whenever GILPool or GILGuard is created.
prepare_freethreaded_pythonNeither PyPy nor GraalPy
Prepares the use of Python in a free-threaded context.
register_decref⚠
Registers a Python object pointer inside the release pool, to have its reference count decreased the next time the GIL is acquired in pyo3.
register_incref⚠py-clone
Increments the reference count of a Python object if the GIL is held. If the GIL is not held, this function will panic.
with_embedded_python_interpreter⚠Neither PyPy nor GraalPy
Executes the provided closure with an embedded Python interpreter.

Type Aliases§

PyObjVec πŸ”’
⚠️ Internal Docs ⚠️ Not Public API πŸ‘‰ Official Docs Here