VISR  0.11.1
Versatile Interactive Scene Renderer
visr::pythonsupport::GilEnsureGuard Class Reference

#include <gil_ensure_guard.hpp>

Classes

class  Impl
 

Public Member Functions

 GilEnsureGuard ()
 
 ~GilEnsureGuard ()
 

Detailed Description

RAII-style lock guard to ensure that the PyGILState_Ensure() / PyGILState_Realease() pair is executed in the current scope. This implementation differs from pybind11::gil_scoped_acquire in the sense that it can be called in an arbitrary thread (that might not have a an initialized pybind11 local thread state.

Note
Incidentally, this implementation is functionally identical with pybind11::gil_scoped_acquire if compiled for PyPy, but not when used with the standard CPython interface.

Constructor & Destructor Documentation

◆ GilEnsureGuard()

visr::pythonsupport::GilEnsureGuard::GilEnsureGuard ( )

Constructor, ensures that the current thread is initialized to call Python C++ API and locks the Python global interpreter lock (GIL).

◆ ~GilEnsureGuard()

visr::pythonsupport::GilEnsureGuard::~GilEnsureGuard ( )
default

Destructor, sets the thread state to the state it had before constructor had been called. Also releases the GIL.


The documentation for this class was generated from the following files: