diff options
author | deischen <deischen@FreeBSD.org> | 2003-04-18 07:09:43 +0000 |
---|---|---|
committer | deischen <deischen@FreeBSD.org> | 2003-04-18 07:09:43 +0000 |
commit | d729efd111ee19870b3bb070e86f12c4057aa3b1 (patch) | |
tree | c4540fbdb5dd93853283bd4d70315482a539912b /lib/libkse/thread/thr_suspend_np.c | |
parent | 556bb64555ef5aede171c8ea3372a6c814dd324d (diff) | |
download | FreeBSD-src-d729efd111ee19870b3bb070e86f12c4057aa3b1.zip FreeBSD-src-d729efd111ee19870b3bb070e86f12c4057aa3b1.tar.gz |
Sorry folks; I accidentally committed a patch from what I was working
on a couple of days ago. This should be the most recent changes.
Noticed by: davidxu
Diffstat (limited to 'lib/libkse/thread/thr_suspend_np.c')
-rw-r--r-- | lib/libkse/thread/thr_suspend_np.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/lib/libkse/thread/thr_suspend_np.c b/lib/libkse/thread/thr_suspend_np.c index 3025584..321786b 100644 --- a/lib/libkse/thread/thr_suspend_np.c +++ b/lib/libkse/thread/thr_suspend_np.c @@ -56,9 +56,7 @@ _pthread_suspend_np(pthread_t thread) == 0) { /* Lock the threads scheduling queue: */ THR_SCHED_LOCK(curthread, thread); - suspend_common(thread); - /* Unlock the threads scheduling queue: */ THR_SCHED_UNLOCK(curthread, thread); @@ -80,10 +78,7 @@ _pthread_suspend_all_np(void) KSE_LOCK_ACQUIRE(curthread->kse, &_thread_list_lock); TAILQ_FOREACH(thread, &_thread_list, tle) { - if ((thread != curthread) && - (thread->state != PS_DEAD) && - (thread->state != PS_DEADLOCK) && - ((thread->flags & THR_FLAGS_EXITING) == 0)) { + if (thread != curthread) { THR_SCHED_LOCK(curthread, thread); suspend_common(thread); THR_SCHED_UNLOCK(curthread, thread); @@ -98,9 +93,13 @@ _pthread_suspend_all_np(void) void suspend_common(struct pthread *thread) { - thread->flags |= THR_FLAGS_SUSPENDED; - if (thread->flags & THR_FLAGS_IN_RUNQ) { - THR_RUNQ_REMOVE(thread); - THR_SET_STATE(thread, PS_SUSPENDED); + if ((thread->state != PS_DEAD) && + (thread->state != PS_DEADLOCK) && + ((thread->flags & THR_FLAGS_EXITING) == 0)) { + thread->flags |= THR_FLAGS_SUSPENDED; + if ((thread->flags & THR_FLAGS_IN_RUNQ) != 0) { + THR_RUNQ_REMOVE(thread); + THR_SET_STATE(thread, PS_SUSPENDED); + } } } |