summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_kse.c
diff options
context:
space:
mode:
authorjulian <julian@FreeBSD.org>2003-04-18 00:16:13 +0000
committerjulian <julian@FreeBSD.org>2003-04-18 00:16:13 +0000
commit0e096a3dd163c27944c9b093848e512ae4954d04 (patch)
treeb465081feb462d7e46cfb9b2b9f85de50af4fec7 /sys/kern/kern_kse.c
parent5c54a6ed57f16b5abad741cd6e4e2386a01ec61c (diff)
downloadFreeBSD-src-0e096a3dd163c27944c9b093848e512ae4954d04.zip
FreeBSD-src-0e096a3dd163c27944c9b093848e512ae4954d04.tar.gz
Add a thread_unlink() and use it.
It could also be used twice in kern_thr.c but that's owned by jeff so I'l let him change it when he's next there.
Diffstat (limited to 'sys/kern/kern_kse.c')
-rw-r--r--sys/kern/kern_kse.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/sys/kern/kern_kse.c b/sys/kern/kern_kse.c
index 784d45b..5f03369 100644
--- a/sys/kern/kern_kse.c
+++ b/sys/kern/kern_kse.c
@@ -1198,17 +1198,7 @@ thread_exit(void)
* all this stuff.
*/
if (p->p_numthreads > 1) {
- /*
- * Unlink this thread from its proc and the kseg.
- * In keeping with the other structs we probably should
- * have a thread_unlink() that does some of this but it
- * would only be called from here (I think) so it would
- * be a waste. (might be useful for proc_fini() as well.)
- */
- TAILQ_REMOVE(&p->p_threads, td, td_plist);
- p->p_numthreads--;
- TAILQ_REMOVE(&kg->kg_threads, td, td_kglist);
- kg->kg_numthreads--;
+ thread_unlink(td);
if (p->p_maxthrwaits)
wakeup(&p->p_numthreads);
/*
@@ -1315,6 +1305,19 @@ thread_link(struct thread *td, struct ksegrp *kg)
kg->kg_numthreads++;
}
+void
+thread_unlink(struct thread *td)
+{
+ struct proc *p = td->td_proc;
+ struct ksegrp *kg = td->td_ksegrp;
+
+ TAILQ_REMOVE(&p->p_threads, td, td_plist);
+ p->p_numthreads--;
+ TAILQ_REMOVE(&kg->kg_threads, td, td_kglist);
+ kg->kg_numthreads--;
+ /* could clear a few other things here */
+}
+
/*
* Purge a ksegrp resource. When a ksegrp is preparing to
* exit, it calls this function.
OpenPOWER on IntegriCloud