diff options
author | davidxu <davidxu@FreeBSD.org> | 2006-09-21 04:21:30 +0000 |
---|---|---|
committer | davidxu <davidxu@FreeBSD.org> | 2006-09-21 04:21:30 +0000 |
commit | d2c57b7fad5ce91e8b900f315b41d142831b90f1 (patch) | |
tree | f7b8debfd8a0b2054c46d867116922ddcfad5995 /lib/libthr/thread/thr_create.c | |
parent | 92bd1e76b1d6d685331ec54d7b5703a34d37f84e (diff) | |
download | FreeBSD-src-d2c57b7fad5ce91e8b900f315b41d142831b90f1.zip FreeBSD-src-d2c57b7fad5ce91e8b900f315b41d142831b90f1.tar.gz |
use rtprio_thread system call to get or set thread priority.
Diffstat (limited to 'lib/libthr/thread/thr_create.c')
-rw-r--r-- | lib/libthr/thread/thr_create.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/libthr/thread/thr_create.c b/lib/libthr/thread/thr_create.c index dc22fe3..99e3d0c 100644 --- a/lib/libthr/thread/thr_create.c +++ b/lib/libthr/thread/thr_create.c @@ -29,6 +29,7 @@ #include "namespace.h" #include <sys/types.h> +#include <sys/rtprio.h> #include <sys/signalvar.h> #include <errno.h> #include <stdlib.h> @@ -50,7 +51,8 @@ _pthread_create(pthread_t * thread, const pthread_attr_t * attr, { struct pthread *curthread, *new_thread; struct thr_param param; - struct thr_sched_param sched_param; + struct sched_param sched_param; + struct rtprio rtp; int ret = 0, locked, create_suspended; sigset_t set, oset; @@ -144,12 +146,12 @@ _pthread_create(pthread_t * thread, const pthread_attr_t * attr, if (new_thread->attr.flags & PTHREAD_SCOPE_SYSTEM) param.flags |= THR_SYSTEM_SCOPE; if (new_thread->attr.sched_inherit == PTHREAD_INHERIT_SCHED) - param.sched_param = NULL; + param.rtp = NULL; else { - param.sched_param = &sched_param; - param.sched_param_size = sizeof(sched_param); - sched_param.policy = new_thread->attr.sched_policy; - sched_param.param.sched_priority = new_thread->attr.prio; + sched_param.sched_priority = new_thread->attr.prio; + _schedparam_to_rtp(new_thread->attr.sched_policy, + &sched_param, &rtp); + param.rtp = &rtp; } /* Schedule the new thread. */ |