diff --git a/sys/kern/kern_kthread.c b/sys/kern/kern_kthread.c
index cb231c8c6558..03d404bd801e 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();
 }