summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
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