aboutsummaryrefslogtreecommitdiff
path: root/externals/grill/flext/source/flcontainers.h
diff options
context:
space:
mode:
authorThomas Grill <xovo@users.sourceforge.net>2005-07-06 16:08:20 +0000
committerThomas Grill <xovo@users.sourceforge.net>2005-07-06 16:08:20 +0000
commit216da4973fc523fc207d5d0f5986da227e7e6665 (patch)
tree41a77238b1b922bc8855ec54a861e76b3eb89336 /externals/grill/flext/source/flcontainers.h
parent8d2c1c06ae0d256689d3ec6de169f9bf75d96028 (diff)
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
Diffstat (limited to 'externals/grill/flext/source/flcontainers.h')
-rw-r--r--externals/grill/flext/source/flcontainers.h43
1 files changed, 42 insertions, 1 deletions
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: