diff options
author | Richard Braun <rbraun@sceen.net> | 2014-04-30 20:31:00 +0200 |
---|---|---|
committer | Richard Braun <rbraun@sceen.net> | 2014-04-30 20:31:00 +0200 |
commit | 14d73afebf4d4d231868bf2c6d56105dc824bee3 (patch) | |
tree | 29c28012cccecefa99fa1ca1197c8304fedea0db /kern/thread.c | |
parent | c8278303cc26f78da5072f0a457fa33271170f79 (diff) |
kern/thread: actually call TSD destructors
Diffstat (limited to 'kern/thread.c')
-rw-r--r-- | kern/thread.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/kern/thread.c b/kern/thread.c index ec722898..c1f1b02a 100644 --- a/kern/thread.c +++ b/kern/thread.c @@ -1494,6 +1494,7 @@ thread_destroy(struct thread *thread) { struct thread_runq *runq; unsigned long flags, state; + unsigned int i; do { runq = thread_lock_runq(thread, &flags); @@ -1501,6 +1502,14 @@ thread_destroy(struct thread *thread) thread_unlock_runq(runq, flags); } while (state != THREAD_DEAD); + for (i = 0; i < thread_nr_keys; i++) { + if ((thread->tsd[i] == NULL) + || (thread_dtors[i] == NULL)) + continue; + + thread_dtors[i](thread->tsd[i]); + } + task_remove_thread(thread->task, thread); kmem_cache_free(&thread_stack_cache, thread->stack); kmem_cache_free(&thread_cache, thread); |