Merge branch 'branch-weiyu' of ssh://plrg.eecs.uci.edu:/home/git/random-fuzzer into...
[c11tester.git] / include / mutex.h
index e015ea599f7373d59125f3eaf69fcfce7e1f3a0e..64473b2ae783d1e83313ca5d179128e6c0bb8502 100644 (file)
@@ -7,29 +7,34 @@
 #define __CXX_MUTEX__
 
 #include "modeltypes.h"
-//#include <mutex>
+#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;}
+
+private:
+       struct mutex_state state;
+};
+
+class snapmutex : public mutex {
+public:
+       snapmutex() : mutex()
+       { }
+       SNAPSHOTALLOC
+};
 }
-#endif /* __CXX_MUTEX__ */
+#endif /* __CXX_MUTEX__ */