12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- #include <errno.h>
- #include <sched.h>
- #include <string.h>
- #include "pthreadP.h"
- #include <lowlevellock.h>
- int
- __pthread_setschedparam (threadid, policy, param)
- pthread_t threadid;
- int policy;
- const struct sched_param *param;
- {
- struct pthread *pd = (struct pthread *) threadid;
-
- if (INVALID_TD_P (pd))
-
- return ESRCH;
- int result = 0;
-
- pthread_cleanup_push ((void (*) (void *)) lll_unlock_wake_cb, &pd->lock);
- lll_lock (pd->lock);
-
- if (__builtin_expect (sched_setscheduler (pd->tid, policy,
- param) == -1, 0))
- result = errno;
- else
- {
-
- pd->schedpolicy = policy;
- memcpy (&pd->schedparam, param, sizeof (struct sched_param));
- pd->flags |= ATTR_FLAG_SCHED_SET | ATTR_FLAG_POLICY_SET;
- }
- lll_unlock (pd->lock);
- pthread_cleanup_pop (0);
- return result;
- }
- strong_alias (__pthread_setschedparam, pthread_setschedparam)
|