Fixed superglue deadlock on standalone (#896). Fixed some elemSize opencv asserts in debug build (876)

This commit is contained in:
matlabbe
2023-09-17 01:19:59 -07:00
parent fb466a6a96
commit f1cd819673
11 changed files with 68 additions and 129 deletions

View File

@@ -11,31 +11,31 @@
#include <string>
#include <rtabmap/utilite/UMutex.h>
#include <Python.h>
namespace pybind11 {
class scoped_interpreter;
class gil_scoped_release;
}
namespace rtabmap {
/**
* Create a single PythonInterface on main thread at
* global scope before any Python classes.
*/
class PythonInterface
{
public:
PythonInterface();
virtual ~PythonInterface();
protected:
std::string getTraceback(); // should be called between lock() and unlock()
void lock();
void unlock();
private:
static UMutex mutex_;
static int refCount_;
protected:
static PyThreadState * mainThreadState_;
static unsigned long mainThreadID_;
PyThreadState * threadState_;
pybind11::scoped_interpreter* guard_;
pybind11::gil_scoped_release* release_;
};
std::string getPythonTraceback();
}
#endif /* CORELIB_SRC_PYTHON_PYTHONINTERFACE_H_ */