diff options
author | 1999-11-25 07:01:27 +0000 | |
---|---|---|
committer | 1999-11-25 07:01:27 +0000 | |
commit | 55c3be94fd3300052ae99760eb43f4d203a9deb4 (patch) | |
tree | 7e280922b53046d374ca3a322bae9e199089037b /lib/libpthread/uthread/uthread_setschedparam.c | |
parent | keep freebsd's thread info distcint from mine (diff) | |
download | wireguard-openbsd-55c3be94fd3300052ae99760eb43f4d203a9deb4.tar.xz wireguard-openbsd-55c3be94fd3300052ae99760eb43f4d203a9deb4.zip |
sync with FreeBSD
Diffstat (limited to 'lib/libpthread/uthread/uthread_setschedparam.c')
-rw-r--r-- | lib/libpthread/uthread/uthread_setschedparam.c | 18 |
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); } |