Change action_list_buffer to snapshot memory instead of half-shapshot-half-non-snapshot
[c11tester.git] / include / mutex.h
1 /**
2  * @file mutex
3  * @brief C++11 mutex interface header
4  */
5
6 #ifndef __CXX_MUTEX__
7 #define __CXX_MUTEX__
8
9 #include "modeltypes.h"
10 #include "mymemory.h"
11
12 namespace cdsc {
13 struct mutex_state {
14         void *locked;   /* Thread holding the lock */
15         thread_id_t alloc_tid;
16         modelclock_t alloc_clock;
17         int init;       // WL
18 };
19
20 class mutex {
21 public:
22         mutex();
23         ~mutex() {}
24         void lock();
25         bool try_lock();
26         void unlock();
27         struct mutex_state * get_state() {return &state;}
28
29 private:
30         struct mutex_state state;
31 };
32
33 class snapmutex : public mutex {
34 public:
35         snapmutex() : mutex()
36         { }
37         SNAPSHOTALLOC
38 };
39 }
40 #endif  /* __CXX_MUTEX__ */