Module pyo3::gil

source ·
Expand description

Interaction with Python’s global interpreter lock

Structs§

  • GILGuard 🔒
    RAII type that represents the Global Interpreter Lock acquisition.
  • GILPoolDeprecated
    A RAII pool which PyO3 uses to store owned Python references.
  • LockGIL 🔒
    Used to lock safe access to the GIL
  • Thread-safe storage for objects which were inc_ref / dec_ref while the GIL was not held.
  • SuspendGIL 🔒
    A guard which can be used to temporarily release the GIL and restore on Drop.

Constants§

  • GIL_COUNT 🔒
    This is an internal counter in pyo3 monitoring whether this thread has the GIL.
  • OWNED_OBJECTS 🔒 Debug-assertions enabled
    Temporarily hold objects that will be released when the GILPool drops.

Statics§

Functions§

  • Decrements pyo3’s internal GIL count - to be called whenever GILPool or GILGuard is dropped.
  • Checks whether the GIL is acquired.
  • 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.
  • Registers a Python object pointer inside the release pool, to have its reference count decreased the next time the GIL is acquired in pyo3.
  • Registers a Python object pointer inside the release pool, to have its reference count increased the next time the GIL is acquired in pyo3.
  • Registers an owned object inside the GILPool, to be released when the GILPool drops.
  • with_embedded_python_interpreterNeither PyPy nor GraalPy
    Executes the provided closure with an embedded Python interpreter.

Type Aliases§

⚠️ Internal Docs ⚠️ Not Public API 👉 Official Docs Here