diff options
author | 2002-01-19 23:42:40 +0000 | |
---|---|---|
committer | 2002-01-19 23:42:40 +0000 | |
commit | 684268045a3e776b15da52c1806111438f0a8001 (patch) | |
tree | 6e100b5b653cf321a98bfdd3ae5fc6711ab5788a /lib/libpthread/uthread | |
parent | From Patrik Lindergren (patrik@ipunplugged.com): (diff) | |
download | wireguard-openbsd-684268045a3e776b15da52c1806111438f0a8001.tar.xz wireguard-openbsd-684268045a3e776b15da52c1806111438f0a8001.zip |
From FreeBSD: correct priority handling.
Diffstat (limited to 'lib/libpthread/uthread')
-rw-r--r-- | lib/libpthread/uthread/uthread_getschedparam.c | 5 | ||||
-rw-r--r-- | lib/libpthread/uthread/uthread_setschedparam.c | 9 |
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: */ |