projects
/
cdsspec-compiler.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
c0eda11
)
threads: cleanup inconsistencies in memory management
author
Brian Norris
<banorris@uci.edu>
Tue, 24 Apr 2012 03:16:05 +0000
(20:16 -0700)
committer
Brian Norris
<banorris@uci.edu>
Tue, 24 Apr 2012 03:16:05 +0000
(20:16 -0700)
threads.cc
patch
|
blob
|
history
diff --git
a/threads.cc
b/threads.cc
index 7d4d22e7aafc68c2cf9e4332e9fceff7465ead46..7e23f59dcf902fd4693e9fea34e81439e7a518ef 100644
(file)
--- a/
threads.cc
+++ b/
threads.cc
@@
-58,7
+58,8
@@
void Thread::complete()
if (state != THREAD_COMPLETED) {
DEBUG("completed thread %d\n", get_id());
state = THREAD_COMPLETED;
- stack_free(stack);
+ if (stack)
+ stack_free(stack);
}
}
@@
-85,10
+86,11
@@
Thread::Thread(thrd_t *t) {
start_routine = NULL;
arg = NULL;
+ create_context();
+ stack = NULL;
state = THREAD_CREATED;
id = model->get_next_id();
*user_thread = id;
- create_context();
model->add_system_thread(this);
}