diff options
author | David Xu <davidxu@FreeBSD.org> | 2006-07-13 06:35:43 +0000 |
---|---|---|
committer | David Xu <davidxu@FreeBSD.org> | 2006-07-13 06:35:43 +0000 |
commit | 561a89f9457194c9d92d6783eb091b1a9736dae3 (patch) | |
tree | a578a4c69968927b0ae5c15efa30827ff9d1c6ef /lib/libthr/thread/thr_getschedparam.c | |
parent | ba493ceb6bf95551b85cada1be47b5121b6bf0bc (diff) |
Use thr_setscheduler, thr_getscheduler and thr_setschedparam to implement
pthread functions.
Notes
Notes:
svn path=/head/; revision=160321
Diffstat (limited to 'lib/libthr/thread/thr_getschedparam.c')
-rw-r--r-- | lib/libthr/thread/thr_getschedparam.c | 26 |
1 files changed, 6 insertions, 20 deletions
diff --git a/lib/libthr/thread/thr_getschedparam.c b/lib/libthr/thread/thr_getschedparam.c index acd02358c2e1..9d581ed3ae9c 100644 --- a/lib/libthr/thread/thr_getschedparam.c +++ b/lib/libthr/thread/thr_getschedparam.c @@ -57,34 +57,20 @@ _pthread_getschedparam(pthread_t pthread, int *policy, * thread. */ THR_LOCK(curthread); - - /* - * XXX Here we need two separated syscalls, atomic is only - * guaranteed in thread library, a new syscall is needed. - */ - - *policy = sched_getscheduler((pid_t)curthread->tid); - if (*policy == -1) + ret = thr_getscheduler((pid_t)curthread->tid, policy, param, + sizeof(param)); + if (ret == -1) ret = errno; - else { - ret = sched_getparam((pid_t)curthread->tid, param); - if (ret == -1) - ret = errno; - } THR_UNLOCK(curthread); } /* 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); - *policy = sched_getscheduler((pid_t)pthread->tid); - if (*policy == -1) + ret = thr_getscheduler(pthread->tid, policy, param, + sizeof(param)); + if (ret == -1) ret = errno; - else { - ret = sched_getparam((pid_t)pthread->tid, param); - if (ret == -1) - ret = errno; - } THR_THREAD_UNLOCK(curthread, pthread); _thr_ref_delete(curthread, pthread); } |