diff -r 3a6b7da09b4f sys/kern/kern_kthread.c --- a/sys/kern/kern_kthread.c Mon Jan 25 11:52:47 2010 -0500 +++ b/sys/kern/kern_kthread.c Mon Jan 25 16:12:46 2010 -0500 @@ -319,12 +319,15 @@ kthread_exit(void) * 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); PROC_SLOCK(p); + if (curthread->td_proc->p_numthreads == 1) { + PROC_UNLOCK(p); + PROC_SUNLOCK(p); + kproc_exit(0); /* never returns */ + } + thread_exit(); }