When single threading a multithreaded program, awaken the

'single threading thread' when the last other thread suspends.
I had this code in there before but it seems to have been
accidentally deleted somewhere along the way.  This would only affect
multithreaded processes.

Reviewed by:	David Xu <bsddiy@yahoo.com>
This commit is contained in:
julian 2002-07-24 19:50:08 +00:00
parent e0a55f1dc7
commit 02977d392e
2 changed files with 14 additions and 0 deletions

View File

@ -749,6 +749,13 @@ thread_suspend_check(int return_instead)
td->td_state = TDS_SUSPENDED;
TAILQ_INSERT_TAIL(&p->p_suspended, td, td_runq);
PROC_UNLOCK(p);
if (P_SHOULDSTOP(p) == P_STOPPED_SNGL) {
if (p->p_numthreads == p->p_suspcount) {
TAILQ_REMOVE(&p->p_suspended,
p->p_singlethread, td_runq);
setrunqueue(p->p_singlethread);
}
}
p->p_stats->p_ru.ru_nivcsw++;
mi_switch();
mtx_unlock_spin(&sched_lock);

View File

@ -749,6 +749,13 @@ thread_suspend_check(int return_instead)
td->td_state = TDS_SUSPENDED;
TAILQ_INSERT_TAIL(&p->p_suspended, td, td_runq);
PROC_UNLOCK(p);
if (P_SHOULDSTOP(p) == P_STOPPED_SNGL) {
if (p->p_numthreads == p->p_suspcount) {
TAILQ_REMOVE(&p->p_suspended,
p->p_singlethread, td_runq);
setrunqueue(p->p_singlethread);
}
}
p->p_stats->p_ru.ru_nivcsw++;
mi_switch();
mtx_unlock_spin(&sched_lock);