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
This commit is contained in:
Konstantin Belousov 2014-11-03 11:29:08 +00:00
parent d2d52b0013
commit 74d5b4af82
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=274038

View File

@ -317,10 +317,6 @@ sys_thr_exit(struct thread *td, struct thr_exit_args *uap)
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 thr_exit_args *uap)
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);