18 lines
291 B
C
18 lines
291 B
C
|
#include <Python.h>
|
||
|
struct PyLockGIL
|
||
|
{
|
||
|
|
||
|
PyLockGIL(): gstate(PyGILState_Ensure())
|
||
|
{
|
||
|
}
|
||
|
|
||
|
~PyLockGIL()
|
||
|
{
|
||
|
PyGILState_Release(gstate);
|
||
|
}
|
||
|
|
||
|
PyLockGIL(const PyLockGIL&) = delete;
|
||
|
PyLockGIL& operator=(const PyLockGIL&) = delete;
|
||
|
|
||
|
PyGILState_STATE gstate;
|
||
|
};
|