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:
parent
e0a55f1dc7
commit
02977d392e
@ -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);
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user