aboutsummaryrefslogtreecommitdiff
path: root/externals/grill/flext/source/flqueue.cpp
diff options
context:
space:
mode:
authorThomas Grill <xovo@users.sourceforge.net>2003-06-05 02:32:52 +0000
committerThomas Grill <xovo@users.sourceforge.net>2003-06-05 02:32:52 +0000
commit1b3a9c2ac678727df211d5de8bd032bc2cf1ac4b (patch)
tree75b3095d66ca2eaa690dc4de5a6fe37da9a58ac6 /externals/grill/flext/source/flqueue.cpp
parenta6d4aa2bcc49633db1d8464f7727cb73e2c0d052 (diff)
""
svn path=/trunk/; revision=683
Diffstat (limited to 'externals/grill/flext/source/flqueue.cpp')
-rwxr-xr-xexternals/grill/flext/source/flqueue.cpp18
1 files changed, 16 insertions, 2 deletions
diff --git a/externals/grill/flext/source/flqueue.cpp b/externals/grill/flext/source/flqueue.cpp
index 92045fbf..9d0b27c6 100755
--- a/externals/grill/flext/source/flqueue.cpp
+++ b/externals/grill/flext/source/flqueue.cpp
@@ -12,6 +12,8 @@ WARRANTIES, see the file, "license.txt," in this distribution.
\brief Implementation of the flext message queuing functionality.
\todo Let's see if queuing can be implemented for Max/MSP with defer_low
+
+ if FLEXT_PDLOCK is defined, the new PD thread lock functions are used
*/
#include "flext.h"
@@ -67,7 +69,7 @@ void flext_base::QTick(flext_base *th)
{
#endif
// post("qtick");
-#if defined(FLEXT_THREADS) && defined(FLEXT_DEBUG)
+#if defined(FLEXT_THREADS) && defined(FLEXT_DEBUG) && !defined(FLEXT_PDLOCK)
if(!th->IsSystemThread()) {
error("flext - Queue tick called by wrong thread!");
return;
@@ -77,6 +79,9 @@ void flext_base::QTick(flext_base *th)
#ifdef FLEXT_THREADS
th->qmutex.Lock();
#endif
+#ifdef FLEXT_PDLOCK
+ pd_lock();
+#endif
for(;;) {
qmsg *m = th->qhead;
if(!m) break;
@@ -140,6 +145,9 @@ void flext_base::QTick(flext_base *th)
m->nxt = NULL;
delete m;
}
+#ifdef FLEXT_PDLOCK
+ pd_unlock();
+#endif
#ifdef FLEXT_THREADS
th->qmutex.Unlock();
#endif
@@ -160,7 +168,13 @@ void flext_base::Queue(qmsg *m)
#endif
#if FLEXT_SYS == FLEXT_SYS_PD
- clock_delay(qclk,0);
+ #ifdef FLEXT_PDLOCK
+ // wake up a worker thread
+ // (instead of triggering the clock)
+ clock_delay(qclk,0);
+ #else
+ clock_delay(qclk,0);
+ #endif
#elif FLEXT_SYS == FLEXT_SYS_MAX
qelem_set(qclk);
#elif FLEXT_SYS == FLEXT_SYS_JMAX