diff options
-rw-r--r-- | sys/kern/kern_kthread.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/sys/kern/kern_kthread.c b/sys/kern/kern_kthread.c index 5809d14..86a37e6 100644 --- a/sys/kern/kern_kthread.c +++ b/sys/kern/kern_kthread.c @@ -312,18 +312,17 @@ kthread_exit(void) { struct proc *p; + p = curthread->td_proc; + /* A module may be waiting for us to exit. */ wakeup(curthread); - - /* - * We could rely on thread_exit to call exit1() but - * there is extra work that needs to be done - */ - if (curthread->td_proc->p_numthreads == 1) - kproc_exit(0); /* never returns */ - - p = curthread->td_proc; PROC_LOCK(p); + if (curthread->td_proc->p_numthreads == 1) { + PROC_UNLOCK(p); + kproc_exit(0); + + /* NOTREACHED. */ + } PROC_SLOCK(p); thread_exit(); } |