#include "PyInterp_Utils.h"
+#include <iostream>
+
/*!
\class PyLockWrapper
\brief Python GIL wrapper.
PyLockWrapper::PyLockWrapper()
{
_gil_state = PyGILState_Ensure();
+ // Save current thread state for later comparison
+ _state = PyGILState_GetThisThreadState();
}
/*!
*/
PyLockWrapper::~PyLockWrapper()
{
+ PyThreadState * _currState = PyGILState_GetThisThreadState();
+ if (_currState != _state)
+ {
+ std::cout << "!!!!!!!!! PyLockWrapper inconsistency - now entering infinite loop for debugging\n";
+ while(1);
+ }
+
PyGILState_Release(_gil_state);
}