rename threads_internal.h -> threads.h
authorBrian Norris <banorris@uci.edu>
Tue, 17 Apr 2012 23:40:23 +0000 (16:40 -0700)
committerBrian Norris <banorris@uci.edu>
Tue, 17 Apr 2012 23:40:23 +0000 (16:40 -0700)
Makefile
libthreads.cc
model.h
schedule.cc
schedule.h
threads.cc
threads.h [new file with mode: 0644]
threads_internal.h [deleted file]

index de622ecb2b1e3eed7687165b2fa43b1ec88e1a2b..f484bb9dd1d2a9819d9d50e277ef7847ae67a64f 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 CC=g++
 BIN=model
 SOURCE=libthreads.cc schedule.cc libatomic.cc userprog.c model.cc malloc.c threads.cc
-HEADERS=libthreads.h schedule.h common.h libatomic.h model.h threads_internal.h
+HEADERS=libthreads.h schedule.h common.h libatomic.h model.h threads.h
 FLAGS=-Wall -ldl -g
 
 all: ${BIN}
index 7ed5491f675fe91d646a8bec1d056ae712ea2ab3..a43505e0e7d4fa18fda72f1d455532414c67f372 100644 (file)
@@ -1,6 +1,6 @@
 #include "libthreads.h"
 #include "common.h"
-#include "threads_internal.h"
+#include "threads.h"
 
 /* global "model" object */
 #include "model.h"
diff --git a/model.h b/model.h
index 05cdf5ccb54b2f41ee4e45519e477ce0e9021a1b..cd922dff7f945d1808b3e44b91ec433971ab71c2 100644 (file)
--- a/model.h
+++ b/model.h
@@ -7,7 +7,7 @@
 #include "schedule.h"
 #include "libthreads.h"
 #include "libatomic.h"
-#include "threads_internal.h"
+#include "threads.h"
 
 #define VALUE_NONE -1
 
index 60d84a8af6b307d1d51d892e3712aa8d8910ab87..691c6f43088595300ac198783328d4b102c8b0f4 100644 (file)
@@ -1,4 +1,4 @@
-#include "threads_internal.h"
+#include "threads.h"
 #include "schedule.h"
 #include "common.h"
 #include "model.h"
index bdccf1185e07d69e3b84fae13146ee9b6cae5bf0..64531b5e94eb5023887b6779bcd5acb132bc82df 100644 (file)
@@ -3,7 +3,7 @@
 
 #include <queue>
 
-#include "threads_internal.h"
+#include "threads.h"
 #include "model.h"
 
 class Scheduler {
index 397c7894b70291b10016d1d3774ea74f7c840c73..13be39170f23e85c887a953b1f6bf79b8f8e5077 100644 (file)
@@ -3,7 +3,7 @@
 #include "libthreads.h"
 #include "schedule.h"
 #include "common.h"
-#include "threads_internal.h"
+#include "threads.h"
 
 /* global "model" object */
 #include "model.h"
diff --git a/threads.h b/threads.h
new file mode 100644 (file)
index 0000000..7427eeb
--- /dev/null
+++ b/threads.h
@@ -0,0 +1,47 @@
+#ifndef __THREADS_H__
+#define __THREADS_H__
+
+#include <ucontext.h>
+
+#include "libthreads.h"
+
+typedef enum thread_state {
+       THREAD_CREATED,
+       THREAD_RUNNING,
+       THREAD_READY,
+       THREAD_COMPLETED
+} thread_state;
+
+class ModelAction;
+
+class Thread {
+public:
+       Thread(thrd_t *t, void (*func)(), void *a);
+       Thread(thrd_t *t);
+       int swap(Thread *t);
+       void dispose();
+
+       thread_state get_state() { return state; }
+       void set_state(thread_state s) { state = s; }
+       thread_id_t get_id();
+       void set_id(thread_id_t i) { *user_thread = i; }
+       thrd_t get_thrd_t() { return *user_thread; }
+private:
+       int create_context();
+
+       void (*start_routine)();
+       void *arg;
+       ucontext_t context;
+       void *stack;
+       thrd_t *user_thread;
+       thread_state state;
+};
+
+Thread *thread_current();
+
+static inline thread_id_t thrd_to_id(thrd_t t)
+{
+       return t;
+}
+
+#endif /* __THREADS_H__ */
diff --git a/threads_internal.h b/threads_internal.h
deleted file mode 100644 (file)
index 4c1e36a..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-#ifndef __THREADS_INTERNAL_H__
-#define __THREADS_INTERNAL_H__
-
-#include <ucontext.h>
-
-#include "libthreads.h"
-
-typedef enum thread_state {
-       THREAD_CREATED,
-       THREAD_RUNNING,
-       THREAD_READY,
-       THREAD_COMPLETED
-} thread_state;
-
-class ModelAction;
-
-class Thread {
-public:
-       Thread(thrd_t *t, void (*func)(), void *a);
-       Thread(thrd_t *t);
-       int swap(Thread *t);
-       void dispose();
-
-       thread_state get_state() { return state; }
-       void set_state(thread_state s) { state = s; }
-       thread_id_t get_id();
-       void set_id(thread_id_t i) { *user_thread = i; }
-       thrd_t get_thrd_t() { return *user_thread; }
-private:
-       int create_context();
-
-       void (*start_routine)();
-       void *arg;
-       ucontext_t context;
-       void *stack;
-       thrd_t *user_thread;
-       thread_state state;
-};
-
-Thread *thread_current();
-
-static inline thread_id_t thrd_to_id(thrd_t t)
-{
-       return t;
-}
-
-#endif /* __THREADS_INTERNAL_H__ */