Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 3 Sep 2014 08:35:42 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r271007 - in head/sys: kern sys
Message-ID:  <201409030835.s838ZgcH094413@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Wed Sep  3 08:35:42 2014
New Revision: 271007
URL: http://svnweb.freebsd.org/changeset/base/271007

Log:
  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

Modified:
  head/sys/kern/kern_thread.c
  head/sys/sys/proc.h

Modified: head/sys/kern/kern_thread.c
==============================================================================
--- head/sys/kern/kern_thread.c	Wed Sep  3 08:30:18 2014	(r271006)
+++ head/sys/kern/kern_thread.c	Wed Sep  3 08:35:42 2014	(r271007)
@@ -549,18 +549,6 @@ thread_link(struct thread *td, struct pr
 }
 
 /*
- * 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().

Modified: head/sys/sys/proc.h
==============================================================================
--- head/sys/sys/proc.h	Wed Sep  3 08:30:18 2014	(r271006)
+++ head/sys/sys/proc.h	Wed Sep  3 08:35:42 2014	(r271007)
@@ -956,7 +956,6 @@ void	thread_suspend_one(struct thread *t
 void	thread_unlink(struct thread *td);
 void	thread_unsuspend(struct proc *p);
 int	thread_unsuspend_one(struct thread *td);
-void	thread_unthread(struct thread *td);
 void	thread_wait(struct proc *p);
 struct thread	*thread_find(struct proc *p, lwpid_t tid);
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201409030835.s838ZgcH094413>