projects
/
c11tester.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
f472540
)
threads: add is_complete() helper function
author
Brian Norris
<banorris@uci.edu>
Thu, 6 Sep 2012 20:10:11 +0000
(13:10 -0700)
committer
Brian Norris
<banorris@uci.edu>
Thu, 6 Sep 2012 20:10:11 +0000
(13:10 -0700)
threads.cc
patch
|
blob
|
history
threads.h
patch
|
blob
|
history
diff --git
a/threads.cc
b/threads.cc
index b3a1d5599fb541d340184e0e2ba0f7589c0ec5ae..a9395926816f38bc4872019a3047357574c1e2b9 100644
(file)
--- a/
threads.cc
+++ b/
threads.cc
@@
-104,7
+104,7
@@
int Thread::swap(ucontext_t *ctxt, Thread *t)
/** Terminate a thread and free its stack. */
void Thread::complete()
{
- if (
state != THREAD_COMPLETED
) {
+ if (
!is_complete()
) {
DEBUG("completed thread %d\n", get_id());
state = THREAD_COMPLETED;
if (stack)
diff --git
a/threads.h
b/threads.h
index e7cd792a134c4b5e223b6f9465af4eaf83753b1e..f7efcf967236b4c57ed22440ffa16a49bca1c5be 100644
(file)
--- a/
threads.h
+++ b/
threads.h
@@
-67,6
+67,9
@@
public:
*/
uint64_t get_return_value() { return last_action_val; }
+ /** @return True if this thread is finished executing */
+ bool is_complete() { return state == THREAD_COMPLETED; }
+
friend void thread_startup();
SNAPSHOTALLOC