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.
This commit is contained in:
parent
87d88cec87
commit
d3a0bd78a8
@ -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.
|
||||
|
@ -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.
|
||||
|
@ -943,6 +943,7 @@ void thread_single_end(void);
|
||||
void thread_stash(struct thread *td);
|
||||
int thread_suspend_check(int how);
|
||||
void thread_suspend_one(struct thread *td);
|
||||
void thread_unlink(struct thread *td);
|
||||
void thread_unsuspend(struct proc *p);
|
||||
void thread_unsuspend_one(struct thread *td);
|
||||
int thread_userret(struct thread *td, struct trapframe *frame);
|
||||
|
Loading…
x
Reference in New Issue
Block a user