- 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:
John Baldwin 2006-02-06 21:56:13 +00:00
parent 2c9d9d392a
commit 934ba9b2cf
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=155400
2 changed files with 12 additions and 6 deletions

View File

@ -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);
/*

View File

@ -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));
}