diff options
author | jhb <jhb@FreeBSD.org> | 2006-02-06 21:56:13 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2006-02-06 21:56:13 +0000 |
commit | db29bc1e158dbd91e9a0fff0a9fa2b95d09f51c4 (patch) | |
tree | e094658caebc7a3fc762c4d6c36c3a35db486c65 /sys/kern/kern_kthread.c | |
parent | 2eb77c6d1842c521b5a3ebcfa89c931f73df07a4 (diff) | |
download | FreeBSD-src-db29bc1e158dbd91e9a0fff0a9fa2b95d09f51c4.zip FreeBSD-src-db29bc1e158dbd91e9a0fff0a9fa2b95d09f51c4.tar.gz |
- 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().
Diffstat (limited to 'sys/kern/kern_kthread.c')
-rw-r--r-- | sys/kern/kern_kthread.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/sys/kern/kern_kthread.c b/sys/kern/kern_kthread.c index e5a0629..bce38c1 100644 --- a/sys/kern/kern_kthread.c +++ b/sys/kern/kern_kthread.c @@ -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)); } |