Mantid
|
Defines a structure for acquiring/releasing the Python GIL using the RAII pattern. More...
#include <GlobalInterpreterLock.h>
Public Member Functions | |
GlobalInterpreterLock () | |
Default constructor. More... | |
~GlobalInterpreterLock () | |
Destructor. More... | |
Static Public Member Functions | |
Static Helpers | |
Check state of lock | |
static bool | locked () |
Check if the current thread has the lock. More... | |
static PyGILState_STATE | acquire () |
Call PyGILState_Ensure. More... | |
static void | release (PyGILState_STATE tstate) |
Call PyGILState_Release. More... | |
Private Member Functions | |
GlobalInterpreterLock (const GlobalInterpreterLock &) | |
Private Attributes | |
PyGILState_STATE | m_state |
Current GIL state. More... | |
Defines a structure for acquiring/releasing the Python GIL using the RAII pattern.
Definition at line 23 of file GlobalInterpreterLock.h.
Mantid::PythonInterface::GlobalInterpreterLock::GlobalInterpreterLock | ( | ) |
Default constructor.
Ensures this thread is ready to call Python code.
Definition at line 49 of file GlobalInterpreterLock.cpp.
Mantid::PythonInterface::GlobalInterpreterLock::~GlobalInterpreterLock | ( | ) |
Destructor.
Resets the Python threadstate to the state before this object was created.
Definition at line 55 of file GlobalInterpreterLock.cpp.
|
private |
|
static |
Call PyGILState_Ensure.
Definition at line 32 of file GlobalInterpreterLock.cpp.
|
static |
Check if the current thread has the lock.
Definition at line 20 of file GlobalInterpreterLock.cpp.
|
static |
Call PyGILState_Release.
There must be have been a call to acquire() to create the tstate value given here.
tstate | The Python threadstate returned by the matching call to acquire() |
Definition at line 40 of file GlobalInterpreterLock.cpp.
Referenced by ~GlobalInterpreterLock().
|
private |
Current GIL state.
Definition at line 43 of file GlobalInterpreterLock.h.
Referenced by ~GlobalInterpreterLock().