mutex: move mutex.h to standard name/location
authorBrian Norris <banorris@uci.edu>
Thu, 11 Oct 2012 23:48:39 +0000 (16:48 -0700)
committerBrian Norris <banorris@uci.edu>
Thu, 11 Oct 2012 23:48:39 +0000 (16:48 -0700)
The important exported interfaces should be in the include/ dir. Also,
C++11 programs should use this header as:

    #include <mutex>

include/mutex [new file with mode: 0644]
model.cc
mutex.cc
mutex.h [deleted file]

diff --git a/include/mutex b/include/mutex
new file mode 100644 (file)
index 0000000..31fd7eb
--- /dev/null
@@ -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__ */
index a96a79c851ee83b5624df3bdafda7487802bf5b1..b3b517caed9c087b0ed1daaeb9a271c4a3a7bc20 100644 (file)
--- a/model.cc
+++ b/model.cc
@@ -1,5 +1,6 @@
 #include <stdio.h>
 #include <algorithm>
+#include <mutex>
 
 #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
index ce747351d09d328708d5410874f77eb40725df1e..91b0b9a33f8a4109d82e9334f127534b1d6ec137 100644 (file)
--- a/mutex.cc
+++ b/mutex.cc
@@ -1,4 +1,5 @@
-#include "mutex.h"
+#include <mutex>
+
 #include "model.h"
 #include "threads-model.h"
 #include "clockvector.h"
diff --git a/mutex.h b/mutex.h
deleted file mode 100644 (file)
index 53fccb2..0000000
--- 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