summaryrefslogtreecommitdiff
path: root/lib/libpthread/uthread
diff options
context:
space:
mode:
authorFederico G. Schwindt <fgsch@cvs.openbsd.org>2002-01-19 23:42:41 +0000
committerFederico G. Schwindt <fgsch@cvs.openbsd.org>2002-01-19 23:42:41 +0000
commit33f51fbe1592131dee92e0a5e874264066f8d9a5 (patch)
tree0348e4c633e9877a417c2d903eddd890202fa5dc /lib/libpthread/uthread
parent9ebe5e77da10fdcc432d37891d31e890599b8aea (diff)
From FreeBSD: correct priority handling.
Diffstat (limited to 'lib/libpthread/uthread')
-rw-r--r--lib/libpthread/uthread/uthread_getschedparam.c5
-rw-r--r--lib/libpthread/uthread/uthread_setschedparam.c9
2 files changed, 9 insertions, 5 deletions
diff --git a/lib/libpthread/uthread/uthread_getschedparam.c b/lib/libpthread/uthread/uthread_getschedparam.c
index 3bfadd1709f..a7f1bf030c6 100644
--- a/lib/libpthread/uthread/uthread_getschedparam.c
+++ b/lib/libpthread/uthread/uthread_getschedparam.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uthread_getschedparam.c,v 1.2 1999/11/25 07:01:36 d Exp $ */
+/* $OpenBSD: uthread_getschedparam.c,v 1.3 2002/01/19 23:42:40 fgsch Exp $ */
/*
* Copyright (c) 1998 Daniel Eischen <eischen@vigrid.com>.
* All rights reserved.
@@ -49,7 +49,8 @@ pthread_getschedparam(pthread_t pthread, int *policy, struct sched_param *param)
/* Find the thread in the list of active threads: */
else if ((ret = _find_thread(pthread)) == 0) {
/* Return the threads base priority and scheduling policy: */
- param->sched_priority = pthread->base_priority;
+ param->sched_priority =
+ PTHREAD_BASE_PRIORITY(pthread->base_priority);
*policy = pthread->attr.sched_policy;
}
diff --git a/lib/libpthread/uthread/uthread_setschedparam.c b/lib/libpthread/uthread/uthread_setschedparam.c
index 18e1efaf7cb..810c0e1fcc1 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.3 2001/08/15 15:45:47 fgsch Exp $ */
+/* $OpenBSD: uthread_setschedparam.c,v 1.4 2002/01/19 23:42:40 fgsch Exp $ */
/*
* Copyright (c) 1998 Daniel Eischen <eischen@vigrid.com>.
* All rights reserved.
@@ -63,19 +63,22 @@ pthread_setschedparam(pthread_t pthread, int policy, const struct sched_param *p
*/
_thread_kern_sig_defer();
- if (param->sched_priority != pthread->base_priority) {
+ if (param->sched_priority !=
+ PTHREAD_BASE_PRIORITY(pthread->base_priority)) {
/*
* Remove the thread from its current priority
* queue before any adjustments are made to its
* active priority:
*/
+ old_prio = pthread->active_priority;
if ((pthread->flags & PTHREAD_FLAGS_IN_PRIOQ) != 0) {
in_readyq = 1;
- old_prio = pthread->active_priority;
PTHREAD_PRIOQ_REMOVE(pthread);
}
/* Set the thread base priority: */
+ pthread->base_priority &=
+ (PTHREAD_SIGNAL_PRIORITY | PTHREAD_RT_PRIORITY);
pthread->base_priority = param->sched_priority;
/* Recalculate the active priority: */