From 86ecf983a799e73b54a13616e5fda6b268c20e5e Mon Sep 17 00:00:00 2001 From: Thomas Grill Date: Wed, 19 Jan 2005 04:57:15 +0000 Subject: - fixed typos and 64-bit compatibility - conform to idle callback functionality in devel_0_38 cleanups svn path=/trunk/; revision=2522 --- externals/grill/flext/source/flbase.h | 2 +- externals/grill/flext/source/fldsp.cpp | 2 +- externals/grill/flext/source/flqueue.cpp | 29 ++++++++++++++++++++++------- 3 files changed, 24 insertions(+), 9 deletions(-) (limited to 'externals/grill/flext/source') diff --git a/externals/grill/flext/source/flbase.h b/externals/grill/flext/source/flbase.h index d6c34e29..732cccbe 100644 --- a/externals/grill/flext/source/flbase.h +++ b/externals/grill/flext/source/flbase.h @@ -105,7 +105,7 @@ class FLEXT_SHARE FLEXT_CLASSDEF(flext_obj): FLEXT_CLASSDEF(flext_obj)(); //! Destructor - virtual ~FLEXT_CLASSDEF(flext_obj)() = 0; + virtual ~FLEXT_CLASSDEF(flext_obj)(); /*! \brief Signal a construction problem \note This should only be used in the constructor. Object creation will be aborted. diff --git a/externals/grill/flext/source/fldsp.cpp b/externals/grill/flext/source/fldsp.cpp index f27ae032..3dd97f4c 100644 --- a/externals/grill/flext/source/fldsp.cpp +++ b/externals/grill/flext/source/fldsp.cpp @@ -89,7 +89,7 @@ void flext_dsp::dspmeth(fts_word_t *w) #else t_int *flext_dsp::dspmeth(t_int *w) { - flext_dsp *obj = (flext_dsp *)w[1]; + flext_dsp *obj = (flext_dsp *)(size_t)w[1]; /* #ifdef FLEXT_DEBUG if(!obj->thisHdr()) { diff --git a/externals/grill/flext/source/flqueue.cpp b/externals/grill/flext/source/flqueue.cpp index 7c47cac6..a7a7ceda 100755 --- a/externals/grill/flext/source/flqueue.cpp +++ b/externals/grill/flext/source/flqueue.cpp @@ -58,7 +58,9 @@ private: const t_atom *argv; }; -// _should_ work without locks.... have yet to check if it really does.... +/* \TODO This is only thread-safe if called fro one thread which need NOT be the case. + Reimplement in a thread-safe manner!!! +*/ class Queue: public flext { @@ -222,7 +224,7 @@ static void QWork(bool syslock) if(!qc) break; #if FLEXT_QMODE == 2 - if(syslock) sys_lock(); + if(syslock) flext::Lock(); #endif // once more, because flushing in destructors could have reduced the count @@ -232,7 +234,7 @@ static void QWork(bool syslock) } // inner loop #if FLEXT_QMODE == 2 - if(syslock) sys_unlock(); + if(syslock) flext::Unlock(); #endif } @@ -253,13 +255,23 @@ static void QTick(flext_base *c) } #elif FLEXT_QMODE == 1 +#ifndef FLEXT_SHARED +static bool qtickactive = false; +#endif static t_int QTick(t_int *) { +#ifndef FLEXT_SHARED + qtickactive = false; +#endif QWork(false); #ifdef FLEXT_SHARED - return 1; + // will be run in the next idle cycle + return 2; #else - return 0; + // won't be run again + // for non-shared externals assume that there's rarely a message waiting + // so it's better to delete the callback meanwhile + return 0; #endif } #endif @@ -287,7 +299,10 @@ static void Trigger() // wake up worker thread qthrcond.Signal(); #elif FLEXT_QMODE == 1 && !defined(FLEXT_SHARED) - set_callback(QTick,NULL,0); + if(!qtickactive) { + sys_callback(QTick,NULL,0); + qtickactive = true; + } #elif FLEXT_QMODE == 0 clock_delay(qclk,0); #endif @@ -324,7 +339,7 @@ void flext_base::StartQueue() #if FLEXT_QMODE == 1 #ifdef FLEXT_SHARED - set_callback(QTick,NULL,0); + sys_callback(QTick,NULL,0); #endif #elif FLEXT_QMODE == 2 LaunchThread(QWorker,NULL); -- cgit v1.2.1