From: Brian Norris Date: Thu, 11 Oct 2012 23:48:39 +0000 (-0700) Subject: mutex: move mutex.h to standard name/location X-Git-Url: http://plrg.eecs.uci.edu/git/?p=c11tester.git;a=commitdiff_plain;h=d5188b9694c29e0d776a643965f2461a1fbbe5e1 mutex: move mutex.h to standard name/location The important exported interfaces should be in the include/ dir. Also, C++11 programs should use this header as: #include --- diff --git a/include/mutex b/include/mutex new file mode 100644 index 00000000..31fd7eb1 --- /dev/null +++ b/include/mutex @@ -0,0 +1,31 @@ +/** + * @file mutex + * @brief C++11 mutex interface header + */ + +#ifndef __CXX_MUTEX__ +#define __CXX_MUTEX__ + +#include "modeltypes.h" + +namespace std { + struct mutex_state { + bool islocked; + thread_id_t alloc_tid; + modelclock_t alloc_clock; + }; + + class mutex { + public: + mutex(); + ~mutex(); + void lock(); + bool try_lock(); + void unlock(); + struct mutex_state * get_state() {return &state;} + + private: + struct mutex_state state; + }; +} +#endif /* __CXX_MUTEX__ */ diff --git a/model.cc b/model.cc index a96a79c8..b3b517ca 100644 --- a/model.cc +++ b/model.cc @@ -1,5 +1,6 @@ #include #include +#include #include "model.h" #include "action.h" @@ -11,7 +12,6 @@ #include "cyclegraph.h" #include "promise.h" #include "datarace.h" -#include "mutex.h" #include "threads-model.h" #define INITIAL_THREAD_ID 0 diff --git a/mutex.cc b/mutex.cc index ce747351..91b0b9a3 100644 --- a/mutex.cc +++ b/mutex.cc @@ -1,4 +1,5 @@ -#include "mutex.h" +#include + #include "model.h" #include "threads-model.h" #include "clockvector.h" diff --git a/mutex.h b/mutex.h deleted file mode 100644 index 53fccb2b..00000000 --- a/mutex.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef MUTEX_H -#define MUTEX_H - -#include "modeltypes.h" - -namespace std { - struct mutex_state { - bool islocked; - thread_id_t alloc_tid; - modelclock_t alloc_clock; - }; - - class mutex { - public: - mutex(); - ~mutex(); - void lock(); - bool try_lock(); - void unlock(); - struct mutex_state * get_state() {return &state;} - - private: - struct mutex_state state; - }; -} -#endif