diff options
author | John Birrell <jb@FreeBSD.org> | 1999-03-23 05:07:56 +0000 |
---|---|---|
committer | John Birrell <jb@FreeBSD.org> | 1999-03-23 05:07:56 +0000 |
commit | 58a7cc5d1be640708d2c5e05bf48a8ae379a8d3e (patch) | |
tree | eea0761f32968ad5456e1c13f86e990df50fa554 /lib/libpthread/thread/thr_setprio.c | |
parent | f5a78334492dccb1f3e9debe40f6e1deb14638fd (diff) |
Notes
Diffstat (limited to 'lib/libpthread/thread/thr_setprio.c')
-rw-r--r-- | lib/libpthread/thread/thr_setprio.c | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/lib/libpthread/thread/thr_setprio.c b/lib/libpthread/thread/thr_setprio.c index dd89f156a50fd..008b6b0352ef4 100644 --- a/lib/libpthread/thread/thr_setprio.c +++ b/lib/libpthread/thread/thr_setprio.c @@ -20,7 +20,7 @@ * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) @@ -38,17 +38,13 @@ int pthread_setprio(pthread_t pthread, int prio) { - int ret; + int ret, policy; + struct sched_param param; - /* Check if the priority is invalid: */ - if (prio < PTHREAD_MIN_PRIORITY || prio > PTHREAD_MAX_PRIORITY) - /* Return an invalid argument error: */ - ret = EINVAL; - - /* Find the thread in the list of active threads: */ - else if ((ret = _find_thread(pthread)) == 0) - /* Set the thread priority: */ - pthread->pthread_priority = prio; + if ((ret = pthread_getschedparam(pthread, &policy, ¶m)) == 0) { + param.sched_priority = prio; + ret = pthread_setschedparam(pthread, policy, ¶m); + } /* Return the error status: */ return (ret); |