summaryrefslogtreecommitdiff
path: root/lib/libpthread/thread/thr_kill.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_kill.c
parentf5a78334492dccb1f3e9debe40f6e1deb14638fd (diff)
Notes
Diffstat (limited to 'lib/libpthread/thread/thr_kill.c')
-rw-r--r--lib/libpthread/thread/thr_kill.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/libpthread/thread/thr_kill.c b/lib/libpthread/thread/thr_kill.c
index 7572c05faff7..c729179c3929 100644
--- a/lib/libpthread/thread/thr_kill.c
+++ b/lib/libpthread/thread/thr_kill.c
@@ -52,6 +52,13 @@ pthread_kill(pthread_t pthread, int sig)
/* Find the thread in the list of active threads: */
else if ((ret = _find_thread(pthread)) == 0) {
+ /*
+ * Guard against preemption by a scheduling signal.
+ * A change of thread state modifies the waiting
+ * and priority queues.
+ */
+ _thread_kern_sched_defer();
+
switch (pthread->state) {
case PS_SIGSUSPEND:
/*
@@ -108,6 +115,12 @@ pthread_kill(pthread_t pthread, int sig)
sigaddset(&pthread->sigpend,sig);
break;
}
+
+ /*
+ * Reenable preemption and yield if a scheduling signal
+ * occurred while in the critical region.
+ */
+ _thread_kern_sched_undefer();
}
/* Return the completion status: */