summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_thread.c
diff options
context:
space:
mode:
authorjulian <julian@FreeBSD.org>2002-08-22 21:45:58 +0000
committerjulian <julian@FreeBSD.org>2002-08-22 21:45:58 +0000
commit169932bd89c145cdb9856cfe6eaf6404cdd06e5a (patch)
treea5d47668028d913f63c63c82275b6116ae3b9620 /sys/kern/kern_thread.c
parent7a233d4c9f8562bf331fa9b7d4d1f649521fb602 (diff)
downloadFreeBSD-src-169932bd89c145cdb9856cfe6eaf6404cdd06e5a.zip
FreeBSD-src-169932bd89c145cdb9856cfe6eaf6404cdd06e5a.tar.gz
slight cleanup of single-threading code for KSE processes
Diffstat (limited to 'sys/kern/kern_thread.c')
-rw-r--r--sys/kern/kern_thread.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/sys/kern/kern_thread.c b/sys/kern/kern_thread.c
index 664dde4..0214237 100644
--- a/sys/kern/kern_thread.c
+++ b/sys/kern/kern_thread.c
@@ -804,6 +804,21 @@ thread_single_end(void)
PROC_LOCK_ASSERT(p, MA_OWNED);
p->p_flag &= ~P_STOPPED_SNGL;
p->p_singlethread = NULL;
- thread_unsuspend(p);
+ /*
+ * If there are other threads they mey now run,
+ * unless of course there is a blanket 'stop order'
+ * on the process. The single threader must be allowed
+ * to continue however as this is a bad place to stop.
+ */
+ if ((p->p_numthreads != 1) && (!P_SHOULDSTOP(p))) {
+ mtx_lock_spin(&sched_lock);
+ while (( td = TAILQ_FIRST(&p->p_suspended))) {
+ TAILQ_REMOVE(&p->p_suspended, td, td_runq);
+ p->p_suspcount--;
+ setrunqueue(td);
+ }
+ mtx_unlock_spin(&sched_lock);
+ }
}
+
OpenPOWER on IntegriCloud