tabbing plus lots of memory fixes
[c11tester.git] / include / mutex.h
index 1903a792ecae6a9556269569b9bc54e09aaecc20..d90d6645e11ab7f00e1d5456a3543c9339895c8b 100644 (file)
@@ -7,28 +7,36 @@
 #define __CXX_MUTEX__
 
 #include "modeltypes.h"
+#include "mymemory.h"
 
 namespace cdsc {
-       struct mutex_state {
-               void *locked; /* Thread holding the lock */
-               thread_id_t alloc_tid;
-               modelclock_t alloc_clock;
-               int init; // WL
-       };
+struct mutex_state {
+       void *locked;   /* Thread holding the lock */
+       thread_id_t alloc_tid;
+       modelclock_t alloc_clock;
+       int init;       // WL
+};
 
-       class mutex {
-       public:
-               mutex();
-               ~mutex() {}
-               void lock();
-               bool try_lock();
-               void unlock();
-               struct mutex_state * get_state() {return &state;}
-               void initialize() { state.init = 1; } // WL
-               bool is_initialized() { return state.init == 1; }
-               
-       private:
-               struct mutex_state state;
-       };
+class mutex {
+public:
+       mutex();
+       ~mutex() {}
+       void lock();
+       bool try_lock();
+       void unlock();
+       struct mutex_state * get_state() {return &state;}
+       void initialize() { state.init = 1; }   // WL
+       bool is_initialized() { return state.init == 1; }
+
+private:
+       struct mutex_state state;
+};
+
+class snapmutex : public mutex {
+public:
+       snapmutex() : mutex()
+       { }
+       SNAPSHOTALLOC
+};
 }
-#endif /* __CXX_MUTEX__ */
+#endif /* __CXX_MUTEX__ */