mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-02 01:20:25 +08:00
Fixed superglue deadlock on standalone (#896). Fixed some elemSize opencv asserts in debug build (876)
This commit is contained in:
@@ -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_ */
|
||||
|
||||
Reference in New Issue
Block a user