aboutsummaryrefslogtreecommitdiff
path: root/externals/grill/flext/source/flcontainers.h
diff options
context:
space:
mode:
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: