1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-16 10:20:30 +00:00

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 Elischer 2002-07-24 19:50:08 +00:00
parent dae0abedbd
commit cf19bf911d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=100632
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);