svn commit: r274038 - head/sys/kern

Konstantin Belousov kib at FreeBSD.org
Mon Nov 3 11:29:09 UTC 2014


Author: kib
Date: Mon Nov  3 11:29:08 2014
New Revision: 274038
URL: https://svnweb.freebsd.org/changeset/base/274038

Log:
  Clean up confusing comment.  Move it to the place of code which is
  talked about.  Explain where the mentioned trampoline located
  (usermode), and the fact that attempt to exit last thread is denied in
  kernel (by delegating the work to usermode).
  
  Sponsored by:	The FreeBSD Foundation
  MFC after:	1 week

Modified:
  head/sys/kern/kern_thr.c

Modified: head/sys/kern/kern_thr.c
==============================================================================
--- head/sys/kern/kern_thr.c	Mon Nov  3 11:21:43 2014	(r274037)
+++ head/sys/kern/kern_thr.c	Mon Nov  3 11:29:08 2014	(r274038)
@@ -317,10 +317,6 @@ sys_thr_exit(struct thread *td, struct t
 
 	PROC_LOCK(p);
 
-	/*
-	 * Shutting down last thread in the proc.  This will actually
-	 * call exit() in the trampoline when it returns.
-	 */
 	if (p->p_numthreads != 1) {
 		racct_sub(p, RACCT_NTHR, 1);
 		LIST_REMOVE(td, td_hash);
@@ -331,6 +327,12 @@ sys_thr_exit(struct thread *td, struct t
 		thread_exit();
 		/* NOTREACHED */
 	}
+
+	/*
+	 * Ignore attempts to shut down last thread in the proc.  This
+	 * will actually call _exit(2) in the usermode trampoline when
+	 * it returns.
+	 */
 	PROC_UNLOCK(p);
 	rw_wunlock(&tidhash_lock);
 	return (0);


More information about the svn-src-all mailing list