32c32
< * $FreeBSD: head/lib/libthr/thread/thr_setprio.c 157457 2006-04-04 02:57:49Z davidxu $
---
> * $FreeBSD: head/lib/libthr/thread/thr_setprio.c 160287 2006-07-12 06:13:18Z davidxu $
46,47c46,48
< int ret, policy;
< struct sched_param param;
---
> struct pthread *curthread = _get_curthread();
> struct sched_param param;
> int ret;
49,51c50,68
< if ((ret = _pthread_getschedparam(pthread, &policy, ¶m)) == 0) {
< param.sched_priority = prio;
< ret = _pthread_setschedparam(pthread, policy, ¶m);
---
> param.sched_priority = prio;
> if (pthread == curthread) {
> THR_LOCK(curthread);
> ret = sched_setparam((pid_t)curthread->tid, ¶m);
> if (ret == -1)
> ret = errno;
> else
> curthread->attr.prio = prio;
> THR_UNLOCK(curthread);
> } else if ((ret = _thr_ref_add(curthread, pthread, /*include dead*/0))
> == 0) {
> THR_THREAD_LOCK(curthread, pthread);
> ret = sched_setparam((pid_t)pthread->tid, ¶m);
> if (ret == -1)
> ret = errno;
> else
> pthread->attr.prio = prio;
> THR_THREAD_UNLOCK(curthread, pthread);
> _thr_ref_delete(curthread, pthread);
53,54d69
<
< /* Return the error status: */
< * $FreeBSD: head/lib/libthr/thread/thr_setprio.c 157457 2006-04-04 02:57:49Z davidxu $
---
> * $FreeBSD: head/lib/libthr/thread/thr_setprio.c 160287 2006-07-12 06:13:18Z davidxu $
46,47c46,48
< int ret, policy;
< struct sched_param param;
---
> struct pthread *curthread = _get_curthread();
> struct sched_param param;
> int ret;
49,51c50,68
< if ((ret = _pthread_getschedparam(pthread, &policy, ¶m)) == 0) {
< param.sched_priority = prio;
< ret = _pthread_setschedparam(pthread, policy, ¶m);
---
> param.sched_priority = prio;
> if (pthread == curthread) {
> THR_LOCK(curthread);
> ret = sched_setparam((pid_t)curthread->tid, ¶m);
> if (ret == -1)
> ret = errno;
> else
> curthread->attr.prio = prio;
> THR_UNLOCK(curthread);
> } else if ((ret = _thr_ref_add(curthread, pthread, /*include dead*/0))
> == 0) {
> THR_THREAD_LOCK(curthread, pthread);
> ret = sched_setparam((pid_t)pthread->tid, ¶m);
> if (ret == -1)
> ret = errno;
> else
> pthread->attr.prio = prio;
> THR_THREAD_UNLOCK(curthread, pthread);
> _thr_ref_delete(curthread, pthread);
53,54d69
<
< /* Return the error status: */