summaryrefslogtreecommitdiffstats
path: root/lib/libthr/thread/thr_getschedparam.c
diff options
context:
space:
mode:
authordavidxu <davidxu@FreeBSD.org>2006-07-13 22:45:19 +0000
committerdavidxu <davidxu@FreeBSD.org>2006-07-13 22:45:19 +0000
commit2b1dbc0acb716180145708fa4f5787322ac795e2 (patch)
tree38d9ff271ff8237cbfb86fa05d16da871f8e0dd2 /lib/libthr/thread/thr_getschedparam.c
parent27c2ca32122c31456d60bac89aae091ff18728b0 (diff)
downloadFreeBSD-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_getschedparam.c')
-rw-r--r--lib/libthr/thread/thr_getschedparam.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/lib/libthr/thread/thr_getschedparam.c b/lib/libthr/thread/thr_getschedparam.c
index 9d581ed..c3233cd 100644
--- a/lib/libthr/thread/thr_getschedparam.c
+++ b/lib/libthr/thread/thr_getschedparam.c
@@ -57,20 +57,17 @@ _pthread_getschedparam(pthread_t pthread, int *policy,
* thread.
*/
THR_LOCK(curthread);
- ret = thr_getscheduler((pid_t)curthread->tid, policy, param,
- sizeof(param));
- if (ret == -1)
- ret = errno;
+ *policy = curthread->attr.sched_policy;
+ param->sched_priority = curthread->attr.prio;
THR_UNLOCK(curthread);
+ ret = 0;
}
/* Find the thread in the list of active threads. */
else if ((ret = _thr_ref_add(curthread, pthread, /*include dead*/0))
== 0) {
THR_THREAD_LOCK(curthread, pthread);
- ret = thr_getscheduler(pthread->tid, policy, param,
- sizeof(param));
- if (ret == -1)
- ret = errno;
+ *policy = pthread->attr.sched_policy;
+ param->sched_priority = pthread->attr.prio;
THR_THREAD_UNLOCK(curthread, pthread);
_thr_ref_delete(curthread, pthread);
}
OpenPOWER on IntegriCloud