diff options
-rw-r--r-- | lib/libkse/thread/thr_kern.c | 9 | ||||
-rw-r--r-- | lib/libpthread/thread/thr_kern.c | 9 |
2 files changed, 10 insertions, 8 deletions
diff --git a/lib/libkse/thread/thr_kern.c b/lib/libkse/thread/thr_kern.c index f1b28c0..02ced94 100644 --- a/lib/libkse/thread/thr_kern.c +++ b/lib/libkse/thread/thr_kern.c @@ -764,7 +764,6 @@ kse_sched_single(struct kse_mailbox *kmbx) break; case PS_DEAD: - curthread->check_pending = 0; /* Unlock the scheduling queue and exit the KSE and thread. */ thr_cleanup(curkse, curthread); KSE_SCHED_UNLOCK(curkse, curkse->k_kseg); @@ -1150,6 +1149,11 @@ thr_cleanup(struct kse *curkse, struct pthread *thread) struct kse_mailbox *kmbx = NULL; int sys_scope; + thread->active = 0; + thread->need_switchout = 0; + thread->lock_switch = 0; + thread->check_pending = 0; + if ((joiner = thread->joiner) != NULL) { /* Joinee scheduler lock held; joiner won't leave. */ if (joiner->kseg == curkse->k_kseg) { @@ -1717,9 +1721,6 @@ kse_switchout_thread(struct kse *kse, struct pthread *thread) * stack. It is safe to do garbage collecting * here. */ - thread->active = 0; - thread->need_switchout = 0; - thread->lock_switch = 0; thr_cleanup(kse, thread); return; break; diff --git a/lib/libpthread/thread/thr_kern.c b/lib/libpthread/thread/thr_kern.c index f1b28c0..02ced94 100644 --- a/lib/libpthread/thread/thr_kern.c +++ b/lib/libpthread/thread/thr_kern.c @@ -764,7 +764,6 @@ kse_sched_single(struct kse_mailbox *kmbx) break; case PS_DEAD: - curthread->check_pending = 0; /* Unlock the scheduling queue and exit the KSE and thread. */ thr_cleanup(curkse, curthread); KSE_SCHED_UNLOCK(curkse, curkse->k_kseg); @@ -1150,6 +1149,11 @@ thr_cleanup(struct kse *curkse, struct pthread *thread) struct kse_mailbox *kmbx = NULL; int sys_scope; + thread->active = 0; + thread->need_switchout = 0; + thread->lock_switch = 0; + thread->check_pending = 0; + if ((joiner = thread->joiner) != NULL) { /* Joinee scheduler lock held; joiner won't leave. */ if (joiner->kseg == curkse->k_kseg) { @@ -1717,9 +1721,6 @@ kse_switchout_thread(struct kse *kse, struct pthread *thread) * stack. It is safe to do garbage collecting * here. */ - thread->active = 0; - thread->need_switchout = 0; - thread->lock_switch = 0; thr_cleanup(kse, thread); return; break; |