diff --git a/sys/kern/kern_thread.c b/sys/kern/kern_thread.c --- a/sys/kern/kern_thread.c +++ b/sys/kern/kern_thread.c @@ -528,6 +528,24 @@ * single threading requirement or some other STOP condition. */ PROC_LOCK(p); + if ((p->p_flag & (P_STOPPED_SINGLE | P_TOTAL_STOP)) == + (P_STOPPED_SINGLE | P_TOTAL_STOP) && + p->p_suspcount + 1 == p->p_numthreads) { + /* + * If we are single-threaded by an remote process, + * there might be nobody making the remote process + * runable after it switches off cpu in + * thread_single(). If the thread requested the + * single-threading is off cpu, poke it to make + * another round in thread_single(). + */ + thread_lock(p->p_singlethread); + if (p->p_singlethread->td_proc != p && + TD_GET_STATE(p->p_singlethread) == TDS_CAN_RUN) + setrunnable(p->p_singlethread, 0); + else + thread_unlock(p->p_singlethread); + } thread_suspend_check(0); PROC_UNLOCK(p); }