When a multi-threaded process dies, its main thread waits until all other
threads are dead before finishing the cleanup. The priority at which it
waits doesn't matter. So I'd like to use PWAIT instead of PUSER to make
it easier to understand the existing scheduler logic.
ok?
Index: kern/kern_exit.c
===================================================================
RCS file: /cvs/src/sys/kern/kern_exit.c,v
retrieving revision 1.176
diff -u -p -r1.176 kern_exit.c
--- kern/kern_exit.c 1 Jun 2019 14:11:17 -0000 1.176
+++ kern/kern_exit.c 1 Jun 2019 16:04:29 -0000
@@ -164,7 +164,7 @@ exit1(struct proc *p, int rv, int flags)
if ((p->p_flag & P_THREAD) == 0) {
/* main thread gotta wait because it has the pid, et al */
while (pr->ps_refcnt > 1)
- tsleep(&pr->ps_threads, PUSER, "thrdeath", 0);
+ tsleep(&pr->ps_threads, PWAIT, "thrdeath", 0);
if (pr->ps_flags & PS_PROFIL)
stopprofclock(pr);
}