From d5c627a611f9b9801d40c3345446c789c9900c5d Mon Sep 17 00:00:00 2001 From: Thomas Grill Date: Wed, 19 Nov 2003 03:37:40 +0000 Subject: "" svn path=/trunk/; revision=1195 --- externals/grill/flext/flext.cw | Bin 880367 -> 880367 bytes externals/grill/flext/source/flsupport.cpp | 41 +++++++++++------------------ 2 files changed, 16 insertions(+), 25 deletions(-) (limited to 'externals/grill/flext') diff --git a/externals/grill/flext/flext.cw b/externals/grill/flext/flext.cw index 5810f001..157b04d7 100644 Binary files a/externals/grill/flext/flext.cw and b/externals/grill/flext/flext.cw differ diff --git a/externals/grill/flext/source/flsupport.cpp b/externals/grill/flext/source/flsupport.cpp index 7b30a2b8..f8c6fac2 100644 --- a/externals/grill/flext/source/flsupport.cpp +++ b/externals/grill/flext/source/flsupport.cpp @@ -74,6 +74,15 @@ void flext::Setup() } +#if defined(FLEXT_THREADED) && defined(FLEXT_PDLOCK) +#define SYSLOCK() sys_lock() +#define SYSUNLOCK() sys_unlock() +#else +#define SYSLOCK(on) (void)0 +#define SYSUNLOCK(on) (void)0 +#endif + + ///////////////////////////////////////////////////////// // overloaded new/delete memory allocation methods // @@ -101,6 +110,7 @@ void *flext_root::operator new(size_t bytes) void flext_root::operator delete(void *blk) { char *ori = (char *)blk-sizeof(size_t); + #if FLEXT_SYS == FLEXT_SYS_JMAX fts_free(ori); #else @@ -114,11 +124,13 @@ void *flext_root::NewAligned(size_t bytes,int bitalign) const size_t ovh = sizeof(size_t)+sizeof(char *); const unsigned long alignovh = bitalign/8-1; bytes += ovh+alignovh; + #if FLEXT_SYS == FLEXT_SYS_JMAX char *blk = (char *)::fts_malloc(bytes); #else char *blk = (char *)::getbytes(bytes); #endif + char *ablk = reinterpret_cast((reinterpret_cast(blk)+ovh+alignovh) & ~alignovh); *(char **)(ablk-sizeof(size_t)-sizeof(char *)) = blk; *(size_t *)(ablk-sizeof(size_t)) = bytes; @@ -184,46 +196,25 @@ int flext::Int2Bits(unsigned long n) void flext_root::post(const char *fmt, ...) { -#ifdef FLEXT_THREADS - static flext::ThrMutex mutex; - mutex.Lock(); -#endif va_list ap; va_start(ap, fmt); -#if FLEXT_SYS == FLEXT_SYS_MAX + char buf[1024]; // \TODO this is quite unsafe..... vsprintf(buf, fmt, ap); ::post(buf); -#else - vfprintf(stderr, fmt, ap); - ::post(""); -#endif + va_end(ap); -#ifdef FLEXT_THREADS - mutex.Unlock(); -#endif } void flext_root::error(const char *fmt,...) { -#ifdef FLEXT_THREADS - static flext::ThrMutex mutex; - mutex.Lock(); -#endif va_list ap; va_start(ap, fmt); -#if FLEXT_SYS == FLEXT_SYS_MAX + char buf[1024]; // \TODO this is quite unsafe..... STD::sprintf(buf,"error: "); vsprintf(buf+7, fmt, ap); ::post(buf); -#else - fprintf(stderr, "error: "); - vfprintf(stderr, fmt, ap); - ::post(""); -#endif + va_end(ap); -#ifdef FLEXT_THREADS - mutex.Unlock(); -#endif } -- cgit v1.2.1