Go to the documentation of this file.
16 #if !defined(PYBIND11_SIMPLE_GIL_MANAGEMENT)
29 #if !defined(PYBIND11_SIMPLE_GIL_MANAGEMENT)
65 tstate = PyGILState_GetThisThreadState();
70 # if defined(PYBIND11_DETAILED_ERROR_MESSAGES)
72 pybind11_fail(
"scoped_acquire: could not create thread state!");
75 tstate->gilstate_counter = 0;
82 PyEval_AcquireThread(
tstate);
94 --
tstate->gilstate_counter;
95 # if defined(PYBIND11_DETAILED_ERROR_MESSAGES)
97 pybind11_fail(
"scoped_acquire::dec_ref(): thread state must be current!");
99 if (
tstate->gilstate_counter < 0) {
100 pybind11_fail(
"scoped_acquire::dec_ref(): reference count underflow!");
103 if (
tstate->gilstate_counter == 0) {
104 # if defined(PYBIND11_DETAILED_ERROR_MESSAGES)
109 PyThreadState_Clear(
tstate);
111 PyThreadState_DeleteCurrent();
142 assert(PyGILState_Check());
148 tstate = PyEval_SaveThread();
173 PyEval_RestoreThread(
tstate);
189 #else // PYBIND11_SIMPLE_GIL_MANAGEMENT
192 PyGILState_STATE
state;
203 PyThreadState *
state;
208 assert(PyGILState_Check());
209 state = PyEval_SaveThread();
217 #endif // PYBIND11_SIMPLE_GIL_MANAGEMENT
PyThreadState * get_thread_state_unchecked()
PYBIND11_NOINLINE void dec_ref()
gil_scoped_acquire & operator=(const gil_scoped_acquire &)=delete
#define PYBIND11_NAMESPACE_END(name)
#define PYBIND11_NOINLINE
#define PYBIND11_TLS_GET_VALUE(key)
PYBIND11_NOINLINE internals & get_internals()
Return a reference to the current internals data.
#define PYBIND11_NAMESPACE_BEGIN(name)
PYBIND11_NOINLINE ~gil_scoped_acquire()
#define PYBIND11_TLS_REPLACE_VALUE(key, value)
gil_scoped_release & operator=(const gil_scoped_release &)=delete
PyExc_RuntimeError PYBIND11_NOINLINE void pybind11_fail(const char *reason)
Used internally.
PyInterpreterState * istate
gil_scoped_release(bool disassoc=false)
const gtsam::Symbol key('X', 0)
PYBIND11_NOINLINE gil_scoped_acquire()
#define PYBIND11_TLS_DELETE_VALUE(key)
PYBIND11_NOINLINE void disarm()
PYBIND11_NOINLINE void disarm()
gtsam
Author(s):
autogenerated on Sat Nov 16 2024 04:02:22