Update of /cvsroot/pure-data/externals/grill/flext/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5604/source
Modified Files: flattr_ed.cpp flcontainers.h flprefix.h flsimd.cpp flsupport.h flthr.cpp fltimer.cpp Log Message: macros for 64-bit architectures fixes for icc@linux fixes for attribute editor (to deal with large dialogs) fix lines on box text change fix for gcc strangeness no more static assignment of symbols (problems with Metrowerks) fixed bugs in SIMD code for non-power-of-2 lengths fixed shared library versioning lock-free thread management don't depend on ldconfig begin in the system path (should be in /sbin/..) fixed flext::Timer::At method new lock-free lifo and fifo
Index: flprefix.h =================================================================== RCS file: /cvsroot/pure-data/externals/grill/flext/source/flprefix.h,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** flprefix.h 26 Jan 2005 05:02:00 -0000 1.30 --- flprefix.h 12 Mar 2005 04:56:34 -0000 1.31 *************** *** 67,74 **** // --- definitions for FLEXT_CPU --------------------- #define FLEXT_CPU_UNKNOWN 0 ! #define FLEXT_CPU_INTEL 1 ! #define FLEXT_CPU_PPC 2 ! #define FLEXT_CPU_MIPS 3 ! #define FLEXT_CPU_ALPHA 4
// --- definitions for FLEXT_THREADS ----------------- --- 67,80 ---- // --- definitions for FLEXT_CPU --------------------- #define FLEXT_CPU_UNKNOWN 0 ! #define FLEXT_CPU_IA32 1 ! #define FLEXT_CPU_PPC 2 ! #define FLEXT_CPU_MIPS 3 ! #define FLEXT_CPU_ALPHA 4 ! ! #define FLEXT_CPU_IA64 5 // Itanium ! #define FLEXT_CPU_X86_64 6 // AMD-K8, EMT64 ! ! // compatibility ! #define FLEXT_CPU_INTEL FLEXT_CPU_IA32
// --- definitions for FLEXT_THREADS ----------------- *************** *** 111,116 ****
#ifndef FLEXT_CPU ! #if defined(_M_IX86) ! #define FLEXT_CPU FLEXT_CPU_INTEL #elif defined(_M_PPC) #define FLEXT_CPU FLEXT_CPU_PPC --- 117,126 ----
#ifndef FLEXT_CPU ! #if defined(_M_AMD64) ! #define FLEXT_CPU FLEXT_CPU_X86_64 ! #elif defined(_M_IA64) ! #define FLEXT_CPU FLEXT_CPU_IA64 ! #elif defined(_M_IX86) ! #define FLEXT_CPU FLEXT_CPU_IA32 #elif defined(_M_PPC) #define FLEXT_CPU FLEXT_CPU_PPC *************** *** 125,129 ****
#ifndef FLEXT_OS ! #if defined(_WIN32) #define FLEXT_OS FLEXT_OS_WIN #define FLEXT_OSAPI FLEXT_OSAPI_WIN_NATIVE --- 135,139 ----
#ifndef FLEXT_OS ! #if defined(_WIN32) || defined(_WIN64) #define FLEXT_OS FLEXT_OS_WIN #define FLEXT_OSAPI FLEXT_OSAPI_WIN_NATIVE *************** *** 212,217 ****
#ifndef FLEXT_CPU ! #if defined(_X86_) || defined(__i386__) || defined(__i586__) || defined(__i686__) ! #define FLEXT_CPU FLEXT_CPU_INTEL #elif defined(__POWERPC__) #define FLEXT_CPU FLEXT_CPU_PPC --- 222,229 ----
#ifndef FLEXT_CPU ! #if defined(_X86_64_) // not sure about this one ! #define FLEXT_CPU FLEXT_CPU_X86_64 ! #elif defined(_X86_) || defined(__i386__) || defined(__i586__) || defined(__i686__) ! #define FLEXT_CPU FLEXT_CPU_IA32 #elif defined(__POWERPC__) #define FLEXT_CPU FLEXT_CPU_PPC
Index: flthr.cpp =================================================================== RCS file: /cvsroot/pure-data/externals/grill/flext/source/flthr.cpp,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** flthr.cpp 26 Jan 2005 05:02:05 -0000 1.27 --- flthr.cpp 12 Mar 2005 04:56:35 -0000 1.28 *************** *** 14,21 ****
#include "flext.h" - #include "flinternal.h"
#ifdef FLEXT_THREADS
#include <time.h> --- 14,26 ----
#include "flext.h"
#ifdef FLEXT_THREADS
+ // maximum wait time for threads to finish (in ms) + #define MAXIMUMWAIT 100 + + + #include "flinternal.h" + #include "flcontainers.h"
#include <time.h> *************** *** 32,36 **** #endif
- #include <errno.h>
--- 37,40 ---- *************** *** 41,49 **** flext::thrid_t flext::thrhelpid = 0;
- static flext::thr_entry *thrhead = NULL,*thrtail = NULL; - static flext::ThrMutex tlmutex;
! //! Helper thread should terminate ! static bool thrhelpexit = false;
//! Helper thread conditional --- 45,103 ---- flext::thrid_t flext::thrhelpid = 0;
! //! \brief This represents an entry to the list of active method threads ! class thr_entry ! : public flext ! , public Fifo::Cell ! { ! public: ! void thr_entry::Set(void (*m)(thr_params *),thr_params *p,thrid_t id = GetThreadId()) ! { ! th = p?p->cl:NULL; ! meth = m,params = p,thrid = id; ! shouldexit = false; ! #if FLEXT_THREADS == FLEXT_THR_MP ! weight = 100; // MP default weight ! #endif ! } ! ! //! \brief Check if this class represents the current thread ! bool Is(thrid_t id = GetThreadId()) const { return IsThread(thrid,id); } ! ! FLEXT_CLASSDEF(flext_base) *This() const { return th; } ! thrid_t Id() const { return thrid; } ! ! FLEXT_CLASSDEF(flext_base) *th; ! void (*meth)(thr_params *); ! thr_params *params; ! thrid_t thrid; ! bool shouldexit; ! #if FLEXT_THREADS == FLEXT_THR_MP ! int weight; ! #endif ! }; ! ! template<class T> ! class ThrFinder: ! public T ! { ! public: ! void Push(thr_entry *e) { T::Push(e); } ! thr_entry *Pop() { return T::Pop(); } ! ! thr_entry *Find(flext::thrid_t id,bool pop = false) ! { ! TypedLifo<thr_entry> qutmp; ! thr_entry *fnd; ! while((fnd = Pop()) && !fnd->Is(id)) qutmp.Push(fnd); ! // put back entries ! for(thr_entry *ti; ti = qutmp.Pop(); ) Push(ti); ! if(fnd && !pop) Push(fnd); ! return fnd; ! } ! }; ! ! static ThrFinder< PooledLifo<thr_entry,1,10> > thrpending; ! static ThrFinder< TypedLifo<thr_entry> > thractive,thrstopped;
//! Helper thread conditional *************** *** 54,63 ****
! void flext::LaunchHelper(thr_entry *e) { ! e->thrid = GetThreadId(); e->meth(e->params); }
//! Start helper thread bool flext::StartHelper() --- 108,118 ----
! static void LaunchHelper(thr_entry *e) { ! e->thrid = flext::GetThreadId(); e->meth(e->params); }
+ //! Start helper thread bool flext::StartHelper() *************** *** 77,81 **** pthread_attr_setdetachstate(&attr,PTHREAD_CREATE_DETACHED);
- thrhelpexit = false; ok = pthread_create (&thrhelpid,&attr,(void *(*)(void *))ThrHelper,NULL) == 0; #elif FLEXT_THREADS == FLEXT_THR_MP --- 132,135 ---- *************** *** 106,120 **** }
- #if 0 - /*! \brief Stop helper thread - \note Never called! - */ - bool flext::StopHelper() - { - thrhelpexit = true; - if(thrhelpcond) thrhelpcond->Signal(); - } - #endif - //! Static helper thread function void flext::ThrHelper(void *) --- 160,163 ---- *************** *** 129,134 **** #endif
- // post("Helper thread started"); - // set thread priority one point below normal // so thread construction won't disturb real-time audio --- 172,175 ---- *************** *** 139,195 **** // helper loop for(;;) { - // post("Helper loop"); - thrhelpcond->Wait(); - if(thrhelpexit) break;
! // post("Helper signalled"); ! tlmutex.Lock(); ! ! // post("Helper after lock"); ! ! // start all inactive threads in queue ! thr_entry *prv = NULL,*ti; ! for(ti = thrhead; ti; prv = ti,ti = ti->nxt) { ! if(!ti->active) { ! bool ok; ! ! // post("Helper start thread"); ! #if FLEXT_THREADS == FLEXT_THR_POSIX ! thrid_t dummy; ! ok = pthread_create (&dummy,&attr,(void *(*)(void *))LaunchHelper,ti) == 0; ! #elif FLEXT_THREADS == FLEXT_THR_MP ! thrid_t dummy; ! ok = MPCreateTask((TaskProc)LaunchHelper,ti,0,0,0,0,0,&dummy) == noErr; ! #elif FLEXT_THREADS == FLEXT_THR_WIN32 ! ok = _beginthread((void (*)(void *))LaunchHelper,0,ti) >= 0; ! #else ! #error ! #endif ! if(!ok) { ! error("flext - Could not launch thread!"); ! ! // delete from queue ! if(prv) ! prv->nxt = ti->nxt; ! else ! thrhead = ti->nxt; ! if(thrtail == ti) thrtail = prv; ! ! ti->nxt = NULL; ! delete ti; ! } ! else { ! // post("Helper thread ok"); ! ! // set active flag ! ti->active = true; ! } ! } ! } ! ! tlmutex.Unlock(); }
delete thrhelpcond; thrhelpcond = NULL; --- 180,215 ---- // helper loop for(;;) { thrhelpcond->Wait();
! // start all inactive threads ! thr_entry *ti; ! while(ti = thrpending.Pop()) { ! bool ok; ! ! #if FLEXT_THREADS == FLEXT_THR_POSIX ! thrid_t dummy; ! ok = pthread_create (&dummy,&attr,(void *(*)(void *))LaunchHelper,ti) == 0; ! #elif FLEXT_THREADS == FLEXT_THR_MP ! thrid_t dummy; ! ok = MPCreateTask((TaskProc)LaunchHelper,ti,0,0,0,0,0,&dummy) == noErr; ! #elif FLEXT_THREADS == FLEXT_THR_WIN32 ! ok = _beginthread((void (*)(void *))LaunchHelper,0,ti) >= 0; ! #else ! #error ! #endif ! if(!ok) { ! error("flext - Could not launch thread!"); ! thrpending.Free(ti); ti = NULL; ! } ! else ! // insert into queue of active threads ! thractive.Push(ti); ! } }
+ FLEXT_ASSERT(false); + /* + // Never reached! + delete thrhelpcond; thrhelpcond = NULL; *************** *** 198,201 **** --- 218,222 ---- pthread_attr_destroy(&attr); #endif + */ }
*************** *** 203,292 **** bool flext::LaunchThread(void (*meth)(thr_params *p),thr_params *p) { ! #ifdef FLEXT_DEBUG ! if(!thrhelpcond) { ! ERRINTERNAL(); ! return false; ! } ! #endif
! // post("make threads");
! tlmutex.Lock();
! // make an entry into thread list ! thr_entry *nt = new thr_entry(meth,p); ! if(thrtail) thrtail->nxt = nt; ! else thrhead = nt; ! thrtail = nt;
! tlmutex.Unlock();
! // post("signal helper");
! // signal thread helper ! thrhelpcond->Signal();
! return true; }
bool flext::StopThread(void (*meth)(thr_params *p),thr_params *p,bool wait) { ! #ifdef FLEXT_DEBUG ! if(!thrhelpcond) { ! ERRINTERNAL(); ! return false; ! } ! #endif
! int found = 0;
! tlmutex.Lock(); ! for(thr_entry *ti = thrhead; ti; ti = ti->nxt) ! // set shouldexit if meth and params match ! if(ti->meth == meth && ti->params == p) { ti->shouldexit = true; found++; } ! tlmutex.Unlock();
! if(found) { ! // signal thread helper ! thrhelpcond->Signal(); ! #if 0 ! // ###################### ! // i don't think we need to wait for a single thread to stop ! // ###################### ! int cnt = 0; ! for(int wi = 0; wi < 100; ++wi) { ! // lock and count this object's threads ! cnt = 0; ! tlmutex.Lock(); ! for(thr_entry *t = thrhead; t; t = t->nxt) ! if(t->meth == meth && t->params == p) ++cnt; ! tlmutex.Unlock();
! // if no threads are remaining, we are done ! if(!cnt) break;
! // Wait ! Sleep(0.01f); ! }
! return cnt == 0; ! #endif ! return true; ! } ! else ! return false; }
bool flext_base::ShouldExit() const { ! bool ret = true; ! ! tlmutex.Lock(); ! for(thr_entry *ti = thrhead; ti; ti = ti->nxt) ! if(ti->Is()) { ret = ti->shouldexit; break; } ! tlmutex.Unlock(); ! ! // thread was not found -> EXIT!!! ! return ret; }
--- 224,328 ---- bool flext::LaunchThread(void (*meth)(thr_params *p),thr_params *p) { ! FLEXT_ASSERT(thrhelpcond);
! // make an entry into thread list ! thr_entry *e = thrpending.New(); ! e->Set(meth,p); ! thrpending.Push(e); ! // signal thread helper ! thrhelpcond->Signal();
! return true; ! }
! static bool waitforstopped(TypedFifo<thr_entry> &qufnd,float wait = 0) ! { ! TypedLifo<thr_entry> qutmp;
! double until; ! if(wait) until = flext::GetOSTime()+wait;
! for(;;) { ! thr_entry *fnd = qufnd.Get(); ! if(!fnd) break; // no more entries -> done!
! thr_entry *ti; ! // search for entry ! while((ti = thrstopped.Pop()) != NULL && ti != fnd) qutmp.Push(ti); ! // put back entries ! while((ti = qutmp.Pop()) != NULL) thrstopped.Push(ti);
! if(ti) { ! // still in thrstopped queue ! qufnd.Put(fnd); ! // yield to other threads ! flext::ThrYield(); ! ! if(wait && flext::GetOSTime() > until) ! // not successful -> remaining thread are still in qufnd queue ! return false; ! } ! } ! return true; }
bool flext::StopThread(void (*meth)(thr_params *p),thr_params *p,bool wait) { ! FLEXT_ASSERT(thrhelpcond);
! TypedLifo<thr_entry> qutmp; ! thr_entry *ti;
! // first search pending queue ! // --------------------------
! { ! bool found = false; ! while((ti = thrpending.Pop()) != NULL) ! if(ti->meth == meth && ti->params == p) { ! // found -> thread hasn't started -> just delete ! thrpending.Free(ti); ! found = true; ! } ! else ! qutmp.Push(ti);
! // put back into pending queue (order doesn't matter) ! while((ti = qutmp.Pop()) != NULL) thrpending.Push(ti);
! if(found) return true; ! }
! // now search active queue ! // ----------------------- ! ! TypedFifo<thr_entry> qufnd; ! ! while((ti = thractive.Pop()) != NULL) ! if(ti->meth == meth && ti->params == p) { ! thrstopped.Push(ti); ! thrhelpcond->Signal(); ! qufnd.Put(ti); ! } ! else ! qutmp.Push(ti); ! ! // put back into pending queue (order doesn't matter) ! while((ti = qutmp.Pop()) != NULL) thractive.Push(ti); ! ! // wakeup helper thread ! thrhelpcond->Signal(); ! ! // now wait for entries in qufnd to have vanished from thrstopped ! if(wait) ! return waitforstopped(qufnd); ! else ! return qufnd.Size() == 0; }
bool flext_base::ShouldExit() const { ! thr_entry *fnd = thrstopped.Find(GetThreadId()); ! return fnd != NULL; }
*************** *** 300,328 **** void flext::PopThread() { ! tlmutex.Lock(); ! ! // post("Pop thread"); ! ! thr_entry *prv = NULL,*ti; ! for(ti = thrhead; ti; prv = ti,ti = ti->nxt) ! if(ti->Is()) break; ! ! if(ti) { ! if(prv) ! prv->nxt = ti->nxt; ! else ! thrhead = ti->nxt; ! if(thrtail == ti) thrtail = prv;
! ti->nxt = NULL; ! delete ti; ! } ! else { #ifdef FLEXT_DEBUG post("flext - INTERNAL ERROR: Thread not found!"); #endif - } - - tlmutex.Unlock(); }
--- 336,349 ---- void flext::PopThread() { ! thrid_t id = GetThreadId(); ! thr_entry *fnd = thrstopped.Find(id,true); ! if(!fnd) fnd = thractive.Find(id,true);
! if(fnd) ! thrpending.Free(fnd); #ifdef FLEXT_DEBUG + else post("flext - INTERNAL ERROR: Thread not found!"); #endif }
*************** *** 330,396 **** bool flext_base::StopThreads() { ! thr_entry *t;
! // signal termination for all object's threads ! tlmutex.Lock(); ! for(t = thrhead; t; t = t->nxt) { ! if(t->This() == this) t->shouldexit = true; ! } ! tlmutex.Unlock();
! // TODO: maybe there should be a thread conditional for every thread so that it can be signalled efficiently
! // wait for thread termination (1 second max.) ! int cnt; ! for(int wi = 0; wi < 100; ++wi) { ! // lock and count this object's threads ! tlmutex.Lock(); ! for(cnt = 0,t = thrhead; t; t = t->nxt) ! if(t->This() == this) ++cnt; ! tlmutex.Unlock();
! // if no threads are remaining, we are done ! if(!cnt) break;
! // Wait ! Sleep(0.01f); ! }
! if(cnt) { #ifdef FLEXT_DEBUG post("flext - doing hard thread termination"); #endif - - // --- all object threads have terminated by now ------- - tlmutex.Lock();
// timeout -> hard termination ! for(t = thrhead; t; ) ! if(t->This() == this) { ! #if FLEXT_THREADS == FLEXT_THR_POSIX ! if(pthread_cancel(t->thrid)) post("%s - Thread could not be terminated!",thisName()); ! #elif FLEXT_THREADS == FLEXT_THR_MP ! MPTerminateTask(t->thrid,0); ! // here, we should use a task queue to check whether the task has really terminated!! ! #elif FLEXT_THREADS == FLEXT_THR_WIN32 ! // can't use the c library function _endthread.. memory leaks will occur ! HANDLE hnd = OpenThread(THREAD_ALL_ACCESS,TRUE,t->thrid); ! TerminateThread(hnd,0); ! #else ! #error ! #endif ! thr_entry *tn = t->nxt; ! t->nxt = NULL; delete t; ! t = tn; ! } ! else t = t->nxt; ! thrhead = NULL; ! ! tlmutex.Unlock(); } ! ! // post("All threads have terminated"); ! ! return true; }
--- 351,420 ---- bool flext_base::StopThreads() { ! FLEXT_ASSERT(thrhelpcond);
! TypedLifo<thr_entry> qutmp; ! thr_entry *ti;
! // first search pending queue ! // --------------------------
! bool found = false; ! while((ti = thrpending.Pop()) != NULL) ! if(ti->This() == this) ! // found -> thread hasn't started -> just delete ! thrpending.Free(ti); ! else ! qutmp.Push(ti);
! // put back into pending queue (order doesn't matter) ! while((ti = qutmp.Pop()) != NULL) thrpending.Push(ti);
! // now search active queue ! // -----------------------
! TypedFifo<thr_entry> qufnd; ! ! while((ti = thractive.Pop()) != NULL) ! if(ti->This() == this) { ! thrstopped.Push(ti); ! thrhelpcond->Signal(); ! qufnd.Put(ti); ! } ! else ! qutmp.Push(ti); ! ! // put back into pending queue (order doesn't matter) ! while((ti = qutmp.Pop()) != NULL) thractive.Push(ti); ! ! // wakeup helper thread ! thrhelpcond->Signal(); ! ! // now wait for entries in qufnd to have vanished from thrstopped ! if(!waitforstopped(qufnd,MAXIMUMWAIT*0.001f)) { #ifdef FLEXT_DEBUG post("flext - doing hard thread termination"); #endif
// timeout -> hard termination ! while((ti = qufnd.Get()) != NULL) { ! #if FLEXT_THREADS == FLEXT_THR_POSIX ! if(pthread_cancel(ti->thrid)) ! post("%s - Thread could not be terminated!",thisName()); ! #elif FLEXT_THREADS == FLEXT_THR_MP ! MPTerminateTask(ti->thrid,0); ! // here, we should use a task queue to check whether the task has really terminated!! ! #elif FLEXT_THREADS == FLEXT_THR_WIN32 ! // can't use the c library function _endthread.. memory leaks will occur ! HANDLE hnd = OpenThread(THREAD_ALL_ACCESS,TRUE,ti->thrid); ! TerminateThread(hnd,0); ! #else ! #error Not implemented ! #endif ! thrpending.Free(ti); ! } ! return false; } ! else ! return true; }
*************** *** 470,476 ****
#elif FLEXT_THREADS == FLEXT_THR_MP ! thr_entry *t; ! for(t = thrhead; t && t->Id() != id; t = t->nxt) {} ! if(t) { // thread found in list int w = GetPriority(id); --- 494,500 ----
#elif FLEXT_THREADS == FLEXT_THR_MP ! thr_entry *ti = thrpending.Find(id); ! if(!ti) ti = thractive.Find(id); ! if(ti) { // thread found in list int w = GetPriority(id); *************** *** 489,493 **** w = 10000; } ! t->weight = w; return MPSetTaskWeight(id,w) == noErr; } --- 513,517 ---- w = 10000; } ! ti->weight = w; return MPSetTaskWeight(id,w) == noErr; } *************** *** 525,531 ****
#elif FLEXT_THREADS == FLEXT_THR_MP ! thr_entry *t; ! for(t = thrhead; t && t->Id() != id; t = t->nxt) {} ! return t?t->weight:-1; #else #error --- 549,555 ----
#elif FLEXT_THREADS == FLEXT_THR_MP ! thr_entry *ti = thrpending.Find(id); ! if(!ti) ti = thractive.Find(id); ! return ti?ti->weight:-1; #else #error *************** *** 567,576 ****
#elif FLEXT_THREADS == FLEXT_THR_MP ! thr_entry *t; ! for(t = thrhead; t && t->Id() != id; t = t->nxt) {} ! if(t) ! return MPSetTaskWeight(id,t->weight = p) == noErr; ! else ! return false; #else #error --- 591,597 ----
#elif FLEXT_THREADS == FLEXT_THR_MP ! thr_entry *ti = thrpending.Find(id); ! if(!ti) ti = thractive.Find(id); ! return ti && MPSetTaskWeight(id,ti->weight = p) == noErr; #else #error *************** *** 586,600 ****
- flext_base::thr_entry::thr_entry(void (*m)(thr_params *),thr_params *p,thrid_t id): - th(p?p->cl:NULL),meth(m),params(p),thrid(id), - active(false),shouldexit(false), - #if FLEXT_THREADS == FLEXT_THR_MP - weight(100), // MP default weight - #endif - nxt(NULL) - {} - - - #if FLEXT_THREADS == FLEXT_THR_POSIX bool flext::ThrCond::Wait() { --- 607,610 ----
Index: flsupport.h =================================================================== RCS file: /cvsroot/pure-data/externals/grill/flext/source/flsupport.h,v retrieving revision 1.79 retrieving revision 1.80 diff -C2 -d -r1.79 -r1.80 *** flsupport.h 26 Feb 2005 04:56:23 -0000 1.79 --- flsupport.h 12 Mar 2005 04:56:34 -0000 1.80 *************** *** 783,812 **** };
- /*! \brief This represents an entry to the list of active method threads - \internal - */ - class FLEXT_SHARE thr_entry: - public flext_root - { - public: - thr_entry(void (*m)(thr_params *),thr_params *p,thrid_t id = GetThreadId()); - - //! \brief Check if this class represents the current thread - bool Is(thrid_t id = GetThreadId()) const { return IsThread(thrid,id); } - - FLEXT_CLASSDEF(flext_base) *This() const { return th; } - thrid_t Id() const { return thrid; } - - FLEXT_CLASSDEF(flext_base) *th; - void (*meth)(thr_params *); - thr_params *params; - thrid_t thrid; - bool active,shouldexit; - #if FLEXT_THREADS == FLEXT_THR_MP - int weight; - #endif - thr_entry *nxt; - }; - protected:
--- 783,786 ---- *************** *** 814,820 **** static thrid_t thrmsgid; static bool StartHelper(); - static bool StopHelper(); static void ThrHelper(void *); - static void LaunchHelper(thr_entry *e);
//! the system's thread id --- 788,792 ---- *************** *** 1082,1085 **** --- 1054,1060 ---- static void Sleep(double s);
+ //! Sleep for a very short amount of time, just to let other threads wake up + static void MiniSleep(); + /*! \brief Class encapsulating a timer with callback functionality. This class can either be used with FLEXT_ADDTIMER or used as a base class with an overloaded virtual Work function.
Index: flcontainers.h =================================================================== RCS file: /cvsroot/pure-data/externals/grill/flext/source/flcontainers.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** flcontainers.h 8 Mar 2005 04:57:01 -0000 1.4 --- flcontainers.h 12 Mar 2005 04:56:34 -0000 1.5 *************** *** 45,49 **** inline Cell *Avail() { return (Cell *)top; }
! #if defined(_MSC_VER) && (defined(_WIN32)) #ifdef __SMP__ #define LOCK lock --- 45,49 ---- inline Cell *Avail() { return (Cell *)top; }
! #if defined(_MSC_VER) && FLEXT_CPU == FLEXT_CPU_IA32 #ifdef __SMP__ #define LOCK lock *************** *** 110,114 ****
inline size_t Size() const { return ic-oc; } ! #elif defined(__GNUC__) && (defined(_X86_) || defined(__i386__)) #ifndef SMPLOCK # ifdef __SMP__ --- 110,114 ----
inline size_t Size() const { return ic-oc; } ! #elif defined(__GNUC__) && FLEXT_CPU == FLEXT_CPU_IA32 #ifndef SMPLOCK # ifdef __SMP__ *************** *** 181,189 **** return n; } ! #elif defined(__GNUC__) && defined(__x86_64__)
#error x86-64 architecture not supported yet
! #elif defined(__GNUC__) && defined(__POWERPC__) inline void Push(register Cell *cl) { --- 181,189 ---- return n; } ! #elif defined(__GNUC__) && FLEXT_CPU == FLEXT_CPU_X64_64
#error x86-64 architecture not supported yet
! #elif defined(__GNUC__) && FLEXT_CPU == FLEXT_CPU_PPC inline void Push(register Cell *cl) {
Index: fltimer.cpp =================================================================== RCS file: /cvsroot/pure-data/externals/grill/flext/source/fltimer.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** fltimer.cpp 11 Feb 2005 04:56:07 -0000 1.7 --- fltimer.cpp 12 Mar 2005 04:56:36 -0000 1.8 *************** *** 110,114 **** }
- /* \param qu determines whether timed messages should be queued (low priority - only when supported by the system). */ --- 110,113 ----
Index: flattr_ed.cpp =================================================================== RCS file: /cvsroot/pure-data/externals/grill/flext/source/flattr_ed.cpp,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** flattr_ed.cpp 23 Feb 2005 04:55:58 -0000 1.34 --- flattr_ed.cpp 12 Mar 2005 04:56:33 -0000 1.35 *************** *** 252,289 **** "wm protocol $id WM_DELETE_WINDOW [concat flext_cancel $id]\n"
"set row 0\n"
// set grow parameters ! "grid columnconfigure $id 0 -weight 1\n" // label ! "grid columnconfigure $id {1 4} -weight 3\n" // value entry ! "grid columnconfigure $id {2 3} -weight 0\n" // copy buttons ! "grid columnconfigure $id 5 -weight 1\n" // apply button ! "grid columnconfigure $id {6 7 8} -weight 0\n" // radio buttons
! // "grid rowconfigure $id {0 1 2} -weight 0\n"
// set column labels ! "label $id.label -text {attribute} -height 2 -font {Helvetica 9 bold}\n" ! "label $id.init -text {initial value} -height 2 -font {Helvetica 9 bold}\n" ! "label $id.copy -text {copy} -height 2 -font {Helvetica 9 bold}\n" ! "label $id.val -text {current value} -height 2 -font {Helvetica 9 bold}\n" ! "label $id.apply -text {} -height 2 -font {Helvetica 9 bold}\n" // why must this be empty? "foreach {i txt} {0 {don't\rsave} 1 {do\rinit} 2 {always\rsave} } {\n" ! "label $id.b$i -text $txt -height 2 -font {Helvetica 9 bold}\n" "}\n" - // "label $id.options -text {options} -height 2\n"
! "grid config $id.label -column 0 -row $row \n" ! "grid config $id.init -column 1 -row $row \n" ! "grid config $id.copy -column 2 -columnspan 2 -row $row \n" ! "grid config $id.val -column 4 -row $row \n" ! "grid config $id.apply -column 5 -row $row \n" ! "foreach i {0 1 2} { grid config $id.b$i -column [expr $i + 6] -row $row }\n" ! // "grid config $id.options -column 3 -row 0 \n" "incr row\n"
// Separator ! "frame $id.sep -relief ridge -bd 1 -height 2\n" ! "grid config $id.sep -column 0 -columnspan 9 -row $row -pady 2 -sticky {snew}\n" "incr row\n" ); --- 252,288 ---- "wm protocol $id WM_DELETE_WINDOW [concat flext_cancel $id]\n"
+ "frame $id.frame\n" "set row 0\n"
// set grow parameters ! "grid columnconfigure $id.frame 0 -weight 1\n" // label ! "grid columnconfigure $id.frame {1 4} -weight 3\n" // value entry ! "grid columnconfigure $id.frame {2 3} -weight 0\n" // copy buttons ! "grid columnconfigure $id.frame 5 -weight 1\n" // apply button ! "grid columnconfigure $id.frame {6 7 8} -weight 0\n" // radio buttons
! "grid rowconfigure $id.frame {0 1} -weight 0\n"
// set column labels ! "label $id.frame.label -text {attribute} -font {Helvetica 9 bold}\n" ! "label $id.frame.init -text {initial value} -font {Helvetica 9 bold}\n" ! "label $id.frame.copy -text {copy} -font {Helvetica 9 bold}\n" ! "label $id.frame.val -text {current value} -font {Helvetica 9 bold}\n" ! "label $id.frame.apply -text {} -font {Helvetica 9 bold}\n" // why must this be empty? "foreach {i txt} {0 {don't\rsave} 1 {do\rinit} 2 {always\rsave} } {\n" ! "label $id.frame.b$i -text $txt -font {Helvetica 7 bold}\n" "}\n"
! "grid config $id.frame.label -column 0 -row $row \n" ! "grid config $id.frame.init -column 1 -row $row \n" ! "grid config $id.frame.copy -column 2 -columnspan 2 -row $row \n" ! "grid config $id.frame.val -column 4 -row $row \n" ! "grid config $id.frame.apply -column 5 -row $row \n" ! "foreach i {0 1 2} { grid config $id.frame.b$i -column [expr $i + 6] -row $row }\n" "incr row\n"
// Separator ! "frame $id.frame.sep -relief ridge -bd 1 -height 2\n" ! "grid config $id.frame.sep -column 0 -columnspan 9 -row $row -pady 2 -sticky {snew}\n" "incr row\n" ); *************** *** 291,295 **** "set ix 1\n" "foreach {an av ai atp asv afl} $attrlist {\n" ! "grid rowconfigure $id $row -weight 0\n"
// get attribute name --- 290,294 ---- "set ix 1\n" "foreach {an av ai atp asv afl} $attrlist {\n" ! "grid rowconfigure $id.frame $row -weight 1\n"
// get attribute name *************** *** 321,326 ****
// attribute label ! "label $id.label-$ix -text "$an :" -font {Helvetica 8 bold}\n" ! "grid config $id.label-$ix -column 0 -row $row -padx 5 -sticky {e}\n" ); sys_vgui( --- 320,325 ----
// attribute label ! "label $id.frame.label-$ix -text "$an :" -font {Helvetica 8 bold}\n" ! "grid config $id.frame.label-$ix -column 0 -row $row -padx 5 -sticky {e}\n" ); sys_vgui( *************** *** 334,376 **** "switch $atp {\n" "0 - 1 {\n" // int or float ! "entry $id.init-$ix -textvariable $var_attr_init\n" ! "entry $id.val-$ix -textvariable $var_attr_val\n" "}\n" "2 {\n" // boolean ! "checkbutton $id.init-$ix -variable $var_attr_init\n" ! "checkbutton $id.val-$ix -variable $var_attr_val\n" "}\n" "3 {\n" // symbol ! "entry $id.init-$ix -textvariable $var_attr_init\n" ! "entry $id.val-$ix -textvariable $var_attr_val\n" "}\n" "4 - 5 {\n" // list or unknown ! "entry $id.init-$ix -textvariable $var_attr_init\n" ! "bind $id.init-$ix {<Control-Button-1>} " flext_textzoom $id.init-$ix $var_attr_init { $title } $an 1"\n" ! "entry $id.val-$ix -textvariable $var_attr_val\n" ! "bind $id.val-$ix {<Control-Button-1>} " flext_textzoom $id.val-$ix $var_attr_val { $title } $an 1"\n" "}\n" "}\n"
! "grid config $id.init-$ix -column 1 -row $row -padx 5 -sticky {ew}\n" ! "grid config $id.val-$ix -column 4 -row $row -padx 5 -sticky {ew}\n"
// copy buttons ! "button $id.b2i-$ix -text {<-} -height 1 -command " flext_copyval $var_attr_init $var_attr_val "\n" ! "grid config $id.b2i-$ix -column 2 -row $row -sticky {ew}\n" ! "button $id.b2c-$ix -text {->} -height 1 -command " flext_copyval $var_attr_val $var_attr_init "\n" ! "grid config $id.b2c-$ix -column 3 -row $row -sticky {ew}\n"
// apply button ! "button $id.apply-$ix -text {Apply} -height 1 -command " flext_apply $id $ix "\n" ! "grid config $id.apply-$ix -column 5 -row $row -sticky {ew}\n" ! ! // "tk_optionMenu $id.opt-$ix $var_attr_save {don't save} {initialize} {always save}\n" ! // "grid config $id.opt-$ix -column 5 -row $ix \n"
// radiobuttons "foreach {i c} {0 black 1 blue 2 red} {\n" ! "radiobutton $id.b$i-$ix -value $i -foreground $c -variable $var_attr_save \n" ! "grid config $id.b$i-$ix -column [expr $i + 6] -row $row \n" "}\n" ); --- 333,372 ---- "switch $atp {\n" "0 - 1 {\n" // int or float ! "entry $id.frame.init-$ix -textvariable $var_attr_init\n" ! "entry $id.frame.val-$ix -textvariable $var_attr_val\n" "}\n" "2 {\n" // boolean ! "checkbutton $id.frame.init-$ix -variable $var_attr_init\n" ! "checkbutton $id.frame.val-$ix -variable $var_attr_val\n" "}\n" "3 {\n" // symbol ! "entry $id.frame.init-$ix -textvariable $var_attr_init\n" ! "entry $id.frame.val-$ix -textvariable $var_attr_val\n" "}\n" "4 - 5 {\n" // list or unknown ! "entry $id.frame.init-$ix -textvariable $var_attr_init\n" ! "bind $id.frame.init-$ix {<Control-Button-1>} " flext_textzoom $id.frame.init-$ix $var_attr_init { $title } $an 1"\n" ! "entry $id.frame.val-$ix -textvariable $var_attr_val\n" ! "bind $id.frame.val-$ix {<Control-Button-1>} " flext_textzoom $id.frame.val-$ix $var_attr_val { $title } $an 1"\n" "}\n" "}\n"
! "grid config $id.frame.init-$ix -column 1 -row $row -padx 5 -sticky {ew}\n" ! "grid config $id.frame.val-$ix -column 4 -row $row -padx 5 -sticky {ew}\n"
// copy buttons ! "button $id.frame.b2i-$ix -text {<-} -height 1 -command " flext_copyval $var_attr_init $var_attr_val "\n" ! "grid config $id.frame.b2i-$ix -column 2 -row $row -sticky {ew}\n" ! "button $id.frame.b2c-$ix -text {->} -height 1 -command " flext_copyval $var_attr_val $var_attr_init "\n" ! "grid config $id.frame.b2c-$ix -column 3 -row $row -sticky {ew}\n"
// apply button ! "button $id.frame.apply-$ix -text {Apply} -height 1 -command " flext_apply $id $ix "\n" ! "grid config $id.frame.apply-$ix -column 5 -row $row -sticky {ew}\n"
// radiobuttons "foreach {i c} {0 black 1 blue 2 red} {\n" ! "radiobutton $id.frame.b$i-$ix -value $i -foreground $c -variable $var_attr_save \n" ! "grid config $id.frame.b$i-$ix -column [expr $i + 6] -row $row \n" "}\n" ); *************** *** 384,406 **** "switch $atp {\n" "0 - 1 {\n" // int or float ! "entry $id.val-$ix -textvariable $var_attr_val -state disabled\n" "}\n" "2 {\n" // boolean ! "checkbutton $id.val-$ix -variable $var_attr_val -state disabled\n" "}\n" "3 {\n" // symbol ! "entry $id.val-$ix -textvariable $var_attr_val -state disabled\n" "}\n" "4 - 5 {\n" // list or unknown ! "entry $id.val-$ix -textvariable $var_attr_val -state disabled\n" ! "bind $id.val-$ix {<Control-Button-1>} " flext_textzoom $id.val-$ix $var_attr_val { $title } $an 0"\n" "}\n" "}\n"
! // "entry $id.val-$ix -textvariable $var_attr_val -state disabled\n" ! "grid config $id.val-$ix -column 4 -row $row -padx 5 -sticky {ew}\n"
! "label $id.readonly-$ix -text "read-only"\n" ! "grid config $id.readonly-$ix -column 6 -columnspan 3 -row $row -padx 5 -sticky {ew}\n" "}\n"
--- 380,402 ---- "switch $atp {\n" "0 - 1 {\n" // int or float ! "entry $id.frame.val-$ix -textvariable $var_attr_val -state disabled\n" "}\n" "2 {\n" // boolean ! "checkbutton $id.frame.val-$ix -variable $var_attr_val -state disabled\n" "}\n" "3 {\n" // symbol ! "entry $id.frame.val-$ix -textvariable $var_attr_val -state disabled\n" "}\n" "4 - 5 {\n" // list or unknown ! "entry $id.frame.val-$ix -textvariable $var_attr_val -state disabled\n" ! "bind $id.frame.val-$ix {<Control-Button-1>} " flext_textzoom $id.frame.val-$ix $var_attr_val { $title } $an 0"\n" "}\n" "}\n"
! // "entry $id.fval.val-$ix -textvariable $var_attr_val -state disabled\n" ! "grid config $id.frame.val-$ix -column 4 -row $row -padx 5 -sticky {ew}\n"
! "label $id.frame.readonly-$ix -text "read-only"\n" ! "grid config $id.frame.readonly-$ix -column 6 -columnspan 3 -row $row -padx 5 -sticky {ew}\n" "}\n"
*************** *** 409,423 **** "incr row\n" "}\n" ); sys_vgui( // Separator "frame $id.sep2 -relief ridge -bd 1 -height 2\n" - // "grid rowconfigure $id $row -weight 0\n" - "grid config $id.sep2 -column 0 -columnspan 9 -row $row -pady 5 -sticky {snew}\n" - "incr row\n"
// Buttons "frame $id.buttonframe\n" - "pack $id.buttonframe -side bottom -fill x\n"
"button $id.buttonframe.cancel -text {Leave} -width 20 -command " flext_cancel $id "\n" --- 405,421 ---- "incr row\n" "}\n" + + // empty space + "grid rowconfigure $id.frame $row -weight 1\n" + "frame $id.frame.dummy\n" + "grid config $id.frame.dummy -column 0 -columnspan 9 -row $row\n" + "incr row\n" ); sys_vgui( // Separator "frame $id.sep2 -relief ridge -bd 1 -height 2\n"
// Buttons "frame $id.buttonframe\n"
"button $id.buttonframe.cancel -text {Leave} -width 20 -command " flext_cancel $id "\n" *************** *** 426,436 **** "button $id.buttonframe.help -text {Help} -width 10 -command " flext_help $id "\n"
! "pack $id.buttonframe.cancel -side left -expand 1\n" ! "pack $id.buttonframe.apply -side left -expand 1\n" ! "pack $id.buttonframe.ok -side left -expand 1\n" ! "pack $id.buttonframe.help -side left -expand 1\n"
! // "grid rowconfigure $id $row -weight 0\n" ! "grid config $id.buttonframe -column 0 -columnspan 9 -row $row -pady 5 -sticky {ew}\n"
// Key bindings --- 424,435 ---- "button $id.buttonframe.help -text {Help} -width 10 -command " flext_help $id "\n"
! "grid columnconfigure $id.buttonframe {0 1 2 3} -weight 1\n" ! "grid config $id.buttonframe.cancel $id.buttonframe.apply $id.buttonframe.ok $id.buttonframe.help -padx 2 -sticky {snew}\n"
! // "scrollbar $id.scroll -command "$id.frame yview"\n" ! ! "pack $id.buttonframe $id.sep2 -pady 2 -expand 0 -side bottom -fill x\n" ! // "pack $id.scroll -side right -fill y\n" ! "pack $id.frame -expand 1 -side top -fill both\n"
// Key bindings *************** *** 540,544 **** }
! sys_vgui(const_cast<char *>(list?"%s {\n":"%s\n"),GetString(sym));
AtomList lv; --- 539,543 ---- }
! sys_vgui(const_cast<char *>(list?"%s {":"%s "),GetString(sym));
AtomList lv; *************** *** 554,563 **** if(i < lv.Count()-1) { *(b++) = ' '; *b = 0; } } ! sys_vgui("%s\n",buf); } else ! sys_vgui("{}\n");
! sys_vgui(const_cast<char *>(list?"} {\n":" \n"));
if(pattr) { --- 553,562 ---- if(i < lv.Count()-1) { *(b++) = ' '; *b = 0; } } ! sys_vgui("%s",buf); } else ! sys_vgui("{}");
! sys_vgui(const_cast<char *>(list?"} {":" "));
if(pattr) { *************** *** 572,579 **** if(i < lp.Count()-1) { *(b++) = ' '; *b = 0; } } ! sys_vgui("%s\n",buf); } else ! sys_vgui("{}\n");
--- 571,578 ---- if(i < lp.Count()-1) { *(b++) = ' '; *b = 0; } } ! sys_vgui("%s",buf); } else ! sys_vgui("{}");
Index: flsimd.cpp =================================================================== RCS file: /cvsroot/pure-data/externals/grill/flext/source/flsimd.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** flsimd.cpp 10 Mar 2005 04:56:40 -0000 1.19 --- flsimd.cpp 12 Mar 2005 04:56:34 -0000 1.20 *************** *** 67,71 **** #ifdef FLEXT_USE_SIMD
! #if FLEXT_CPU == FLEXT_CPU_INTEL
#define _CPU_FEATURE_MMX 0x0001 --- 67,71 ---- #ifdef FLEXT_USE_SIMD
! #if FLEXT_CPU == FLEXT_CPU_IA32 || FLEXT_CPU == FLEXT_CPU_X84_64
#define _CPU_FEATURE_MMX 0x0001 *************** *** 295,299 **** { unsigned long simdflags = flext::simd_none; ! #if FLEXT_CPU == FLEXT_CPU_INTEL _p_info cpuinfo; int feature = _cpuid(&cpuinfo); --- 295,299 ---- { unsigned long simdflags = flext::simd_none; ! #if FLEXT_CPU == FLEXT_CPU_IA32 || FLEXT_CPU == FLEXT_CPU_AMD64 _p_info cpuinfo; int feature = _cpuid(&cpuinfo);