projects
/
c11tester.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
9d9c0f4
)
threads: assert THREAD_COMPLETED is immutable
author
Brian Norris
<banorris@uci.edu>
Tue, 9 Oct 2012 17:42:50 +0000
(10:42 -0700)
committer
Brian Norris
<banorris@uci.edu>
Tue, 18 Dec 2012 22:58:32 +0000
(14:58 -0800)
threads-model.h
patch
|
blob
|
history
threads.cc
patch
|
blob
|
history
diff --git
a/threads-model.h
b/threads-model.h
index 9a4d959ddd8d380c2562d624b97fc8059f315444..344d58badada9f13297a149c220c0f33d505238a 100644
(file)
--- a/
threads-model.h
+++ b/
threads-model.h
@@
-44,7
+44,7
@@
public:
static int swap(Thread *t, ucontext_t *ctxt);
thread_state get_state() const { return state; }
static int swap(Thread *t, ucontext_t *ctxt);
thread_state get_state() const { return state; }
- void set_state(thread_state s)
{ state = s; }
+ void set_state(thread_state s)
;
thread_id_t get_id() const;
thrd_t get_thrd_t() const { return *user_thread; }
Thread * get_parent() const { return parent; }
thread_id_t get_id() const;
thrd_t get_thrd_t() const { return *user_thread; }
Thread * get_parent() const { return parent; }
diff --git
a/threads.cc
b/threads.cc
index 6b4e2c740ab50b7b55f624b7bda05a4c9ad72678..87de32fb2452f0384016353306b0b0b43c3d4cea 100644
(file)
--- a/
threads.cc
+++ b/
threads.cc
@@
-178,3
+178,13
@@
thread_id_t Thread::get_id() const
{
return id;
}
{
return id;
}
+
+/**
+ * Set a thread's THREAD_* state (@see thread_state)
+ * @param s The state to enter
+ */
+void Thread::set_state(thread_state s)
+{
+ ASSERT(s == THREAD_COMPLETED || state != THREAD_COMPLETED);
+ state = s;
+}