aboutsummaryrefslogtreecommitdiff
path: root/externals/grill/py/source
diff options
context:
space:
mode:
Diffstat (limited to 'externals/grill/py/source')
-rw-r--r--externals/grill/py/source/main.cpp10
-rw-r--r--externals/grill/py/source/main.h9
2 files changed, 15 insertions, 4 deletions
diff --git a/externals/grill/py/source/main.cpp b/externals/grill/py/source/main.cpp
index 33200c8b..89696b46 100644
--- a/externals/grill/py/source/main.cpp
+++ b/externals/grill/py/source/main.cpp
@@ -158,13 +158,17 @@ py::py():
FLEXT_ADDTIMER(stoptmr,tick);
+#ifdef FLEXT_THREADS
// launch thread worker
FLEXT_CALLMETHOD(threadworker);
+#endif
}
py::~py()
{
shouldexit = true;
+
+#ifdef FLEXT_THREADS
qucond.Signal();
if(thrcount) {
@@ -176,7 +180,7 @@ py::~py()
while(thrcount) Sleep(0.01f);
post("%s - Okay, all threads have terminated",thisName());
}
-
+#endif
PyThreadState *state = PyLock();
Py_XDECREF(module_obj);
PyUnlock(state);
@@ -456,10 +460,12 @@ bool py::gencall(PyObject *pmeth,PyObject *pargs)
Py_DECREF(pargs);
Py_DECREF(pmeth);
break;
+#ifdef FLEXT_THREADS
case 1:
// put call into queue
ret = qucall(pmeth,pargs);
break;
+#endif
case 2:
// each call a new thread
if(!shouldexit) {
@@ -491,6 +497,7 @@ void py::work_wrapper(void *data)
--thrcount;
}
+#ifdef FLEXT_THREADS
bool py::qucall(PyObject *fun,PyObject *args)
{
if(qufifo.Push(fun,args)) {
@@ -526,6 +533,7 @@ void py::threadworker()
PyUnlock(state);
}
+#endif
#if FLEXT_SYS == FLEXT_SYS_MAX
short py::patcher_myvol(t_patcher *x)
diff --git a/externals/grill/py/source/main.h b/externals/grill/py/source/main.h
index ef9a16c9..8671a87f 100644
--- a/externals/grill/py/source/main.h
+++ b/externals/grill/py/source/main.h
@@ -133,14 +133,15 @@ protected:
#endif
private:
+
+ void work_wrapper(void *data);
+
+#ifdef FLEXT_THREADS
bool qucall(PyObject *fun,PyObject *args);
void threadworker();
Fifo qufifo;
ThrCond qucond;
- void work_wrapper(void *data);
-
-#ifdef FLEXT_THREADS
FLEXT_THREAD_X(work_wrapper)
#else
FLEXT_CALLBACK_X(work_wrapper)
@@ -194,7 +195,9 @@ protected:
FLEXT_CALLBACK(m_doc)
FLEXT_CALLBACK_T(tick)
+#ifdef FLEXT_THREADS
FLEXT_THREAD(threadworker)
+#endif
};
#endif