From 216da4973fc523fc207d5d0f5986da227e7e6665 Mon Sep 17 00:00:00 2001 From: Thomas Grill Date: Wed, 6 Jul 2005 16:08:20 +0000 Subject: changed initialization functions accordingly FIFO code with mutex lock c++ conformance fix fixes for Codewarrior updates for OSX extracted maps into flmap.h fix for BCC made flext::Forward threadsafe don't install build system yet digest one-element list messages as single atoms updated tutorials fixes for MSVC6 documentation slimmed object data structures simplified message analysis corrected flext version to 0.4.5 added X86-64 code for lockfree fifos preparation of release upgraded version number svn path=/trunk/; revision=3292 --- externals/grill/flext/source/flcontainers.h | 43 ++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) (limited to 'externals/grill/flext/source/flcontainers.h') diff --git a/externals/grill/flext/source/flcontainers.h b/externals/grill/flext/source/flcontainers.h index 0e248ffb..76442d15 100644 --- a/externals/grill/flext/source/flcontainers.h +++ b/externals/grill/flext/source/flcontainers.h @@ -307,8 +307,49 @@ public: } inline size_t Size() const { return oc; } + #else -#error Platform not supported + // no lock free code available for this compiler/platform + + inline void Push(Cell *c) + { +#ifdef FLEXT_THREADS + mutex.Lock(); +#endif + c->link = (Cell *)top; + top = c; + ++oc; +#ifdef FLEXT_THREADS + mutex.Unlock(); +#endif + } + + inline Cell *Pop() + { + if(top) { + Cell *r; +#ifdef FLEXT_THREADS + mutex.Lock(); +#endif + r = (Cell *)top; + top = r->link; + --oc; +#ifdef FLEXT_THREADS + mutex.Unlock(); +#endif + return r; + } + else + return NULL; + } + + inline size_t Size() const { return oc; } + +private: +#ifdef FLEXT_THREADS + flext::ThrMutex mutex; +#endif + #endif private: -- cgit v1.2.1