diff options
-rwxr-xr-x | externals/grill/flext/source/flqueue.cpp | 18 |
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 |