From ec54f5e49b24dc57e389b7bce58f967ee69a4b01 Mon Sep 17 00:00:00 2001 From: Thomas Grill Date: Thu, 15 Dec 2005 23:04:06 +0000 Subject: new flext::CopyAtoms function fixed dangerous spot (also memory leak) with message queuing flext::Forward has more incarnations now added message bundles (flext::MsgBundle) fixes for gcc 3.3, changing FLEXT_USECMEM to FLEXT_USE_CMEMw fixed initialization of message bundle items svn path=/trunk/; revision=4228 --- externals/grill/flext/changes.txt | 2 +- externals/grill/flext/source/flqueue.cpp | 17 +++++++++-------- externals/grill/flext/source/flsupport.cpp | 10 +++++----- externals/grill/flext/source/flsupport.h | 10 +++++----- 4 files changed, 20 insertions(+), 19 deletions(-) (limited to 'externals') diff --git a/externals/grill/flext/changes.txt b/externals/grill/flext/changes.txt index 65826efc..38320249 100644 --- a/externals/grill/flext/changes.txt +++ b/externals/grill/flext/changes.txt @@ -22,7 +22,7 @@ Version history: - cleaned up internals (like Max/MSP typedefs) - fixed coexistence of message and signal objects in Max/MSP object libraries - fixes for pthreads version 2 -- deprecated FLEXT_GLOBALNEW in favor of FLEXT_USECMEM (either global new/delete operators or C library memory allocation) +- deprecated FLEXT_NOGLOBALNEW in favor of FLEXT_USE_CMEM (either global new/delete operators or C library memory allocation) - fixing uninitialized pointer (first inlet pointer) - added message bundle functionality (to send more messages over the thread boundary to arrive at the same logical time) - fixed dangerous spot (also memory leak) with message queuing diff --git a/externals/grill/flext/source/flqueue.cpp b/externals/grill/flext/source/flqueue.cpp index efd6fd51..b1adfb24 100755 --- a/externals/grill/flext/source/flqueue.cpp +++ b/externals/grill/flext/source/flqueue.cpp @@ -49,14 +49,8 @@ class Queue: { public: inline bool Empty() const { return Size() == 0; } - - inline void Push(MsgBundle *m) - { - if(m) { - Put(m); - Trigger(); - } - } + + inline void Push(MsgBundle *m); // defined after MsgBundle (gcc 3.3. won't take it otherwise...) }; static Queue queue; @@ -266,6 +260,13 @@ private: } }; +inline void Queue::Push(MsgBundle *m) +{ + if(m) { + Put(m); + Trigger(); + } +} #if FLEXT_QMODE == 2 static flext::ThrCond qthrcond; diff --git a/externals/grill/flext/source/flsupport.cpp b/externals/grill/flext/source/flsupport.cpp index 929de35e..eaa27a60 100644 --- a/externals/grill/flext/source/flsupport.cpp +++ b/externals/grill/flext/source/flsupport.cpp @@ -106,7 +106,7 @@ void flext::Setup() #define LARGEALLOC 32000 -#ifndef FLEXT_USECMEM +#ifndef FLEXT_USE_CMEM #ifdef FLEXT_DEBUGMEM static const size_t memtest = 0x12345678L; @@ -131,7 +131,7 @@ void *flext_root::operator new(size_t bytes) //! We need system locking here for secondary threads! SYSLOCK(); -#if defined(FLEXT_USECMEM) +#if defined(FLEXT_USE_CMEM) blk = (char *)::malloc(bytes); #else blk = (char *)::getbytes(bytes); @@ -175,7 +175,7 @@ void flext_root::operator delete(void *blk) //! We need system locking here for secondary threads! SYSLOCK(); -#if defined(FLEXT_USECMEM) +#if defined(FLEXT_USE_CMEM) ::free(ori); #else ::freebytes(ori,bytes); @@ -217,7 +217,7 @@ void *flext_root::NewAligned(size_t bytes,int bitalign) //! We need system locking here for secondary threads! SYSLOCK(); -#if defined(FLEXT_USECMEM) +#if defined(FLEXT_USE_CMEM) blk = (char *)::malloc(bytes); #else blk = (char *)::getbytes(bytes); @@ -251,7 +251,7 @@ void flext_root::FreeAligned(void *blk) //! We need system locking here for secondary threads! SYSLOCK(); -#if defined(FLEXT_USECMEM) +#if defined(FLEXT_USE_CMEM) ::free(ori); #else ::freebytes(ori,bytes); diff --git a/externals/grill/flext/source/flsupport.h b/externals/grill/flext/source/flsupport.h index 2a1b7a6d..526a60af 100644 --- a/externals/grill/flext/source/flsupport.h +++ b/externals/grill/flext/source/flsupport.h @@ -47,11 +47,11 @@ public: */ #ifdef FLEXT_NOGLOBALNEW -#error FLEXT_NOGLOBALNEW is deprecated, define FLEXT_USECMEM instead -#define FLEXT_USECMEM +#error FLEXT_NOGLOBALNEW is deprecated, define FLEXT_USE_CMEM instead +#define FLEXT_USE_CMEM #endif -#ifdef FLEXT_USECMEM +#ifdef FLEXT_USE_CMEM inline void *operator new(size_t bytes) { return ::operator new(bytes); } inline void operator delete(void *blk) { ::operator delete(blk); } @@ -104,7 +104,7 @@ public: //! @} FLEXT_S_MEMORY }; -#ifndef FLEXT_USECMEM +#ifndef FLEXT_USE_CMEM /************************************************************************/ // MFC doesn't like global overloading of allocators // anyway, who likes MFC @@ -125,7 +125,7 @@ inline void *operator new[](size_t bytes) NEWTHROW { return flext_root::operator inline void operator delete[](void *blk) DELTHROW { flext_root::operator delete[](blk); } #endif -#endif // FLEXT_USECMEM +#endif // FLEXT_USE_CMEM /************************************************************************/ -- cgit v1.2.1