int _pthread_setprio(pthread_t pthread, int prio) { int ret, policy; struct sched_param param; if ((ret = _pthread_getschedparam(pthread, &policy, ¶m)) == 0) { param.sched_priority = prio; ret = _pthread_setschedparam(pthread, policy, ¶m); } /* Return the error status: */ return (ret); }
int _pthread_getprio(pthread_t pthread) { int policy, ret; struct sched_param param; if ((ret = _pthread_getschedparam(pthread, &policy, ¶m)) == 0) ret = param.sched_priority; else { /* Invalid thread: */ errno = ret; ret = -1; } /* Return the thread priority or an error status: */ return (ret); }