aboutsummaryrefslogtreecommitdiff
path: root/externals/grill/py
diff options
context:
space:
mode:
Diffstat (limited to 'externals/grill/py')
-rw-r--r--externals/grill/py/config-pd-msvc.txt3
-rw-r--r--externals/grill/py/source/main.cpp8
-rw-r--r--externals/grill/py/source/main.h2
-rw-r--r--externals/grill/py/source/pyext.cpp5
4 files changed, 15 insertions, 3 deletions
diff --git a/externals/grill/py/config-pd-msvc.txt b/externals/grill/py/config-pd-msvc.txt
index ed8f1101..f7fe8316 100644
--- a/externals/grill/py/config-pd-msvc.txt
+++ b/externals/grill/py/config-pd-msvc.txt
@@ -9,7 +9,8 @@ PDPATH=c:\programme\audio\pd
FLEXTPATH=$(PDPATH)\flext
# where is MS VC++?
-MSVCPATH=C:\Programme\Microsoft Visual Studio .NET 2003\Vc7
+# (not necessary if the build is run with the compiler environment)
+# MSVCPATH=C:\Programme\Microsoft Visual Studio .NET 2003\Vc7
# which version of Python?
PYTHONVER=python23
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);
diff --git a/externals/grill/py/source/main.h b/externals/grill/py/source/main.h
index 5188b7c3..cf000f9b 100644
--- a/externals/grill/py/source/main.h
+++ b/externals/grill/py/source/main.h
@@ -116,9 +116,9 @@ protected:
public:
static PyInterpreterState *pystate;
- static std::map<flext::thrid_t,PyThreadState *> pythrmap;
#ifdef FLEXT_THREADS
+ static std::map<flext::thrid_t,PyThreadState *> pythrmap;
ThrMutex mutex;
V Lock() { mutex.Unlock(); }
V Unlock() { mutex.Unlock(); }
diff --git a/externals/grill/py/source/pyext.cpp b/externals/grill/py/source/pyext.cpp
index a8dc581e..b8763771 100644
--- a/externals/grill/py/source/pyext.cpp
+++ b/externals/grill/py/source/pyext.cpp
@@ -440,8 +440,9 @@ V pyext::work_wrapper(V *data)
// -----------------------------
// store new thread state
+#ifdef FLEXT_THREADS
pythrmap[GetThreadId()] = newthr;
-
+#endif
{
// call worker
work_data *w = (work_data *)data;
@@ -449,8 +450,10 @@ V pyext::work_wrapper(V *data)
delete w;
}
+#ifdef FLEXT_THREADS
// delete mapped thread state
pythrmap.erase(GetThreadId());
+#endif
// --- delete Python thread ---
// grab the lock