aboutsummaryrefslogtreecommitdiff
path: root/externals/grill/py/source/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'externals/grill/py/source/main.cpp')
-rw-r--r--externals/grill/py/source/main.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/externals/grill/py/source/main.cpp b/externals/grill/py/source/main.cpp
index 72396afb..dbcd27f9 100644
--- a/externals/grill/py/source/main.cpp
+++ b/externals/grill/py/source/main.cpp
@@ -25,7 +25,10 @@ V py::lib_setup()
FLEXT_LIB_SETUP(py,py::lib_setup)
PyInterpreterState *py::pystate = NULL;
+
+#ifdef FLEXT_THREADS
std::map<flext::thrid_t,PyThreadState *> py::pythrmap;
+#endif
I py::pyref = 0;
PyObject *py::module_obj = NULL;
@@ -101,15 +104,20 @@ py::~py()
Py_XDECREF(module);
PyEval_AcquireLock();
+
+#ifdef FLEXT_THREADS
PyThreadState_Swap(pythrmap[GetThreadId()]);
+#endif
#ifdef FLEXT_DEBUG
// need not necessarily do that....
Py_Finalize();
#endif
+#ifdef FLEXT_THREADS
// reset thread state map
pythrmap.clear();
+#endif
}
else {
Py_DECREF(module_obj);