summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_kthread.c
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2011-01-03 16:29:00 +0000
committerjhb <jhb@FreeBSD.org>2011-01-03 16:29:00 +0000
commit22fce0b1c2fdbd43dc60c768421ef81a407a98a0 (patch)
tree47471da5aeef9d7528f03cb137651c83a23bef62 /sys/kern/kern_kthread.c
parent260fa0537924e236f764279f23ed66e10e863791 (diff)
downloadFreeBSD-src-22fce0b1c2fdbd43dc60c768421ef81a407a98a0.zip
FreeBSD-src-22fce0b1c2fdbd43dc60c768421ef81a407a98a0.tar.gz
Small whitespace nits and add a comment explaining why kthread_exit() can
call kproc_exit() that was lost earlier.
Diffstat (limited to 'sys/kern/kern_kthread.c')
-rw-r--r--sys/kern/kern_kthread.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/sys/kern/kern_kthread.c b/sys/kern/kern_kthread.c
index be40c80..9762d9d 100644
--- a/sys/kern/kern_kthread.c
+++ b/sys/kern/kern_kthread.c
@@ -316,17 +316,20 @@ kthread_exit(void)
p = curthread->td_proc;
-
/* A module may be waiting for us to exit. */
wakeup(curthread);
+
+ /*
+ * The last exiting thread in a kernel process must tear down
+ * the whole process.
+ */
rw_wlock(&tidhash_lock);
PROC_LOCK(p);
if (p->p_numthreads == 1) {
PROC_UNLOCK(p);
rw_wunlock(&tidhash_lock);
kproc_exit(0);
-
- /* NOTREACHED. */
+ /* NOTREACHED */
}
LIST_REMOVE(curthread, td_hash);
rw_wunlock(&tidhash_lock);
OpenPOWER on IntegriCloud