- Move the wakeup() for exiting kthreads out of exit1() and into
kthread_exit() as that is cleaner and less obscured. It also does the wakeup sooner. - Add some comments to kthread_exit().
This commit is contained in:
parent
2c9d9d392a
commit
934ba9b2cf
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=155400
@ -508,12 +508,6 @@ exit1(struct thread *td, int rv)
|
||||
psignal(p->p_pptr, p->p_sigparent);
|
||||
}
|
||||
PROC_UNLOCK(p->p_pptr);
|
||||
|
||||
/*
|
||||
* If this is a kthread, then wakeup anyone waiting for it to exit.
|
||||
*/
|
||||
if (p->p_flag & P_KTHREAD)
|
||||
wakeup(p);
|
||||
PROC_UNLOCK(p);
|
||||
|
||||
/*
|
||||
|
@ -129,11 +129,23 @@ kthread_exit(int ecode)
|
||||
|
||||
td = curthread;
|
||||
p = td->td_proc;
|
||||
|
||||
/*
|
||||
* Reparent curthread from proc0 to init so that the zombie
|
||||
* is harvested.
|
||||
*/
|
||||
sx_xlock(&proctree_lock);
|
||||
PROC_LOCK(p);
|
||||
proc_reparent(p, initproc);
|
||||
PROC_UNLOCK(p);
|
||||
sx_xunlock(&proctree_lock);
|
||||
|
||||
/*
|
||||
* Wakeup anyone waiting for us to exit.
|
||||
*/
|
||||
wakeup(p);
|
||||
|
||||
/* Buh-bye! */
|
||||
exit1(td, W_EXITCODE(ecode, 0));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user