summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorjulian <julian@FreeBSD.org>2007-10-26 22:18:20 +0000
committerjulian <julian@FreeBSD.org>2007-10-26 22:18:20 +0000
commit4eb58f88d1889098568e9f9ca175b5a46eccee3b (patch)
tree26da13fea4a55fbe37d72a83af08c49713d87e69 /sys
parent9f54ea2c1ea62112505976504430b6650ef699a0 (diff)
downloadFreeBSD-src-4eb58f88d1889098568e9f9ca175b5a46eccee3b.zip
FreeBSD-src-4eb58f88d1889098568e9f9ca175b5a46eccee3b.tar.gz
If kthread_exit() is called on the last kthread in a kproc, then
all the work in kproc_exit must be done. We don't actually have a user of this yet but why leave it to chance.
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/kern_kthread.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/sys/kern/kern_kthread.c b/sys/kern/kern_kthread.c
index cb231c8..03d404b 100644
--- a/sys/kern/kern_kthread.c
+++ b/sys/kern/kern_kthread.c
@@ -320,6 +320,12 @@ kthread_add(void (*func)(void *), void *arg, struct proc *p,
void
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);
thread_exit();
}
OpenPOWER on IntegriCloud