summaryrefslogtreecommitdiff
path: root/lib/libpthread/thread/thr_suspend_np.c
diff options
context:
space:
mode:
authorJohn Birrell <jb@FreeBSD.org>1999-03-23 05:07:56 +0000
committerJohn Birrell <jb@FreeBSD.org>1999-03-23 05:07:56 +0000
commit58a7cc5d1be640708d2c5e05bf48a8ae379a8d3e (patch)
treeeea0761f32968ad5456e1c13f86e990df50fa554 /lib/libpthread/thread/thr_suspend_np.c
parentf5a78334492dccb1f3e9debe40f6e1deb14638fd (diff)
Notes
Diffstat (limited to 'lib/libpthread/thread/thr_suspend_np.c')
-rw-r--r--lib/libpthread/thread/thr_suspend_np.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/libpthread/thread/thr_suspend_np.c b/lib/libpthread/thread/thr_suspend_np.c
index 871683ad92aba..6a6eaf4304de5 100644
--- a/lib/libpthread/thread/thr_suspend_np.c
+++ b/lib/libpthread/thread/thr_suspend_np.c
@@ -51,8 +51,21 @@ pthread_suspend_np(pthread_t thread)
thread->interrupted = 1;
}
+ /*
+ * Guard against preemption by a scheduling signal.
+ * A change of thread state modifies the waiting
+ * and priority queues.
+ */
+ _thread_kern_sched_defer();
+
/* Suspend the thread. */
PTHREAD_NEW_STATE(thread,PS_SUSPENDED);
+
+ /*
+ * Reenable preemption and yield if a scheduling signal
+ * occurred while in the critical region.
+ */
+ _thread_kern_sched_undefer();
}
return(ret);
}