diff options
author | davidxu <davidxu@FreeBSD.org> | 2006-07-13 22:45:19 +0000 |
---|---|---|
committer | davidxu <davidxu@FreeBSD.org> | 2006-07-13 22:45:19 +0000 |
commit | 2b1dbc0acb716180145708fa4f5787322ac795e2 (patch) | |
tree | 38d9ff271ff8237cbfb86fa05d16da871f8e0dd2 /lib/libthr/thread/thr_init.c | |
parent | 27c2ca32122c31456d60bac89aae091ff18728b0 (diff) | |
download | FreeBSD-src-2b1dbc0acb716180145708fa4f5787322ac795e2.zip FreeBSD-src-2b1dbc0acb716180145708fa4f5787322ac795e2.tar.gz |
Caching scheduling policy and priority in userland, a critical but baddly
written application is frequently changing thread priority for SCHED_OTHER
policy.
Diffstat (limited to 'lib/libthr/thread/thr_init.c')
-rw-r--r-- | lib/libthr/thread/thr_init.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/libthr/thread/thr_init.c b/lib/libthr/thread/thr_init.c index 99bcea3..490c1b7 100644 --- a/lib/libthr/thread/thr_init.c +++ b/lib/libthr/thread/thr_init.c @@ -362,6 +362,8 @@ _libpthread_init(struct pthread *curthread) static void init_main_thread(struct pthread *thread) { + struct sched_param sched_param; + /* Setup the thread attributes. */ thr_self(&thread->tid); thread->attr = _pthread_attr_default; @@ -407,6 +409,10 @@ init_main_thread(struct pthread *thread) thread->state = PS_RUNNING; + thr_getscheduler(thread->tid, &thread->attr.sched_policy, + &sched_param, sizeof(sched_param)); + thread->attr.prio = sched_param.sched_priority; + /* Others cleared to zero by thr_alloc() */ } |