Try harder to get back to being a non threaded process.

Submitted by:	DavidXu
MFC after:	3 days
This commit is contained in:
julian 2004-09-15 18:39:09 +00:00
parent 038388559e
commit 2e88fd3281

View File

@ -829,12 +829,22 @@ thread_single(int force_exit)
remaining = p->p_numthreads - p->p_suspcount;
}
if (force_exit == SINGLE_EXIT) {
/*
* We have gotten rid of all the other threads and we
* are about to either exit or exec. In either case,
* we try our utmost to revert to being a non-threaded
* process.
*/
upcall_remove(td);
p->p_flag &= ~(P_SA|P_HADTHREADS);
td->td_mailbox = NULL;
td->td_pflags &= ~TDP_SA;
td->td_pflags &= ~(TDP_SA | TDP_CAN_UNBIND);
p->p_flag &= ~(P_STOPPED_SINGLE | P_SINGLE_EXIT);
p->p_singlethread = NULL;
if (td->td_standin != NULL) {
thread_stash(td->td_standin);
td->td_standin = NULL;
}
sched_set_concurrency(td->td_ksegrp, 1);
mtx_unlock_spin(&sched_lock);
} else {