summaryrefslogtreecommitdiff
path: root/lib/libpthread/uthread/uthread_setschedparam.c
diff options
context:
space:
mode:
authorDavid Leonard <d@cvs.openbsd.org>1999-11-25 07:01:48 +0000
committerDavid Leonard <d@cvs.openbsd.org>1999-11-25 07:01:48 +0000
commit0fe78c3128864d128b2b10153b8d533ff8c00375 (patch)
tree5229c3d97eed15f4d71927a5f454180aef2632f6 /lib/libpthread/uthread/uthread_setschedparam.c
parented00fa742a6455d22e3b56cf846dc5acd7a51fd7 (diff)
sync with FreeBSD
Diffstat (limited to 'lib/libpthread/uthread/uthread_setschedparam.c')
-rw-r--r--lib/libpthread/uthread/uthread_setschedparam.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/libpthread/uthread/uthread_setschedparam.c b/lib/libpthread/uthread/uthread_setschedparam.c
index 0024460c003..26e1b61d017 100644
--- a/lib/libpthread/uthread/uthread_setschedparam.c
+++ b/lib/libpthread/uthread/uthread_setschedparam.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uthread_setschedparam.c,v 1.1 1999/05/26 00:18:25 d Exp $ */
+/* $OpenBSD: uthread_setschedparam.c,v 1.2 1999/11/25 07:01:43 d Exp $ */
/*
* Copyright (c) 1998 Daniel Eischen <eischen@vigrid.com>.
* All rights reserved.
@@ -30,6 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
+ * $FreeBSD: uthread_setschedparam.c,v 1.3 1999/08/28 00:03:47 peter Exp $
*/
#include <errno.h>
#include <sys/param.h>
@@ -51,10 +52,10 @@ pthread_setschedparam(pthread_t pthread, int policy, const struct sched_param *p
/* Find the thread in the list of active threads: */
else if ((ret = _find_thread(pthread)) == 0) {
/*
- * Guard against being preempted by a scheduling
- * signal:
+ * Defer signals to protect the scheduling queues from
+ * access by the signal handler:
*/
- _thread_kern_sched_defer();
+ _thread_kern_sig_defer();
if (param->sched_priority != pthread->base_priority) {
/*
@@ -62,8 +63,7 @@ pthread_setschedparam(pthread_t pthread, int policy, const struct sched_param *p
* queue before any adjustments are made to its
* active priority:
*/
- if ((pthread != _thread_run) &&
- (pthread->state == PS_RUNNING)) {
+ if ((pthread->flags & PTHREAD_FLAGS_IN_PRIOQ) != 0) {
in_readyq = 1;
old_prio = pthread->active_priority;
PTHREAD_PRIOQ_REMOVE(pthread);
@@ -104,10 +104,10 @@ pthread_setschedparam(pthread_t pthread, int policy, const struct sched_param *p
pthread->attr.sched_policy = policy;
/*
- * Renable preemption and yield if a scheduling signal
- * arrived while in the critical region:
+ * Undefer and handle pending signals, yielding if
+ * necessary:
*/
- _thread_kern_sched_undefer();
+ _thread_kern_sig_undefer();
}
return(ret);
}