bd65a78a57647200dcc7e49a64dabcf3ffd41a4a
[c11tester.git] / include / mutex
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
11 namespace std {
12         struct mutex_state {
13                 void *locked; /* Thread holding the lock */
14                 thread_id_t alloc_tid;
15                 modelclock_t alloc_clock;
16         };
17
18         class mutex {
19         public:
20                 mutex();
21                 ~mutex() {}
22                 void lock();
23                 bool try_lock();
24                 void unlock();
25                 struct mutex_state * get_state() {return &state;}
26                 
27         private:
28                 struct mutex_state state;
29         };
30 }
31 #endif /* __CXX_MUTEX__ */