summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_thread.c
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2014-09-03 08:35:42 +0000
committerkib <kib@FreeBSD.org>2014-09-03 08:35:42 +0000
commit7e3c6a1f22081211cc2cdbad39e6e2b5de5d751d (patch)
tree9abf8e67c0d88e814d2c3ca26b42644be0e4b566 /sys/kern/kern_thread.c
parent2e01608625bd63637f497eeabe62349603566c23 (diff)
downloadFreeBSD-src-7e3c6a1f22081211cc2cdbad39e6e2b5de5d751d.zip
FreeBSD-src-7e3c6a1f22081211cc2cdbad39e6e2b5de5d751d.tar.gz
Retire thread_unthread(), it has only one caller. Update comment in
the block of code before the previous call to thread_unthread(). Discussed with: alc Sponsored by: The FreeBSD Foundation MFC after: 1 week
Diffstat (limited to 'sys/kern/kern_thread.c')
-rw-r--r--sys/kern/kern_thread.c23
1 files changed, 5 insertions, 18 deletions
diff --git a/sys/kern/kern_thread.c b/sys/kern/kern_thread.c
index b132510..71f9b7e 100644
--- a/sys/kern/kern_thread.c
+++ b/sys/kern/kern_thread.c
@@ -549,18 +549,6 @@ thread_link(struct thread *td, struct proc *p)
}
/*
- * Convert a process with one thread to an unthreaded process.
- */
-void
-thread_unthread(struct thread *td)
-{
- struct proc *p = td->td_proc;
-
- KASSERT((p->p_numthreads == 1), ("Unthreading with >1 threads"));
- p->p_flag &= ~P_HADTHREADS;
-}
-
-/*
* Called from:
* thread_exit()
*/
@@ -712,14 +700,13 @@ stopme:
}
if (mode == SINGLE_EXIT) {
/*
- * We have gotten rid of all the other threads and we
- * are about to either exit or exec. In either case,
- * we try our utmost to revert to being a non-threaded
- * process.
+ * Convert the process to an unthreaded process. The
+ * SINGLE_EXIT is called by exit1() or execve(), in
+ * both cases other threads must be retired.
*/
+ KASSERT(p->p_numthreads == 1, ("Unthreading with >1 threads"));
p->p_singlethread = NULL;
- p->p_flag &= ~(P_STOPPED_SINGLE | P_SINGLE_EXIT);
- thread_unthread(td);
+ p->p_flag &= ~(P_STOPPED_SINGLE | P_SINGLE_EXIT | P_HADTHREADS);
/*
* Wait for any remaining threads to exit cpu_throw().
OpenPOWER on IntegriCloud