123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- #include <errno.h>
- #include <sched.h>
- #include <string.h>
- #include <sched.h>
- #include "pthreadP.h"
- #include <lowlevellock.h>
- int
- pthread_setschedprio (
- pthread_t threadid,
- int prio)
- {
- struct pthread *pd = (struct pthread *) threadid;
-
- if (INVALID_TD_P (pd))
-
- return ESRCH;
- int result = 0;
- struct sched_param param;
- param.sched_priority = prio;
- lll_lock (pd->lock, LLL_PRIVATE);
-
- if (__builtin_expect (pd->tpp != NULL, 0) && pd->tpp->priomax > prio)
- param.sched_priority = pd->tpp->priomax;
-
- if (__builtin_expect (sched_setparam (pd->tid, ¶m) == -1, 0))
- result = errno;
- else
- {
-
- param.sched_priority = prio;
- memcpy (&pd->schedparam, ¶m, sizeof (struct sched_param));
- pd->flags |= ATTR_FLAG_SCHED_SET;
- }
- lll_unlock (pd->lock, LLL_PRIVATE);
- return result;
- }
|