12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- #include <errno.h>
- #include <string.h>
- #include "pthreadP.h"
- #include <lowlevellock.h>
- int
- attribute_protected
- __pthread_getschedparam (
- pthread_t threadid,
- int *policy,
- struct sched_param *param)
- {
- struct pthread *pd = (struct pthread *) threadid;
-
- if (INVALID_TD_P (pd))
-
- return ESRCH;
- int result = 0;
- lll_lock (pd->lock, LLL_PRIVATE);
-
- if ((pd->flags & ATTR_FLAG_SCHED_SET) == 0)
- {
- if (sched_getparam (pd->tid, &pd->schedparam) != 0)
- result = 1;
- else
- pd->flags |= ATTR_FLAG_SCHED_SET;
- }
- if ((pd->flags & ATTR_FLAG_POLICY_SET) == 0)
- {
- pd->schedpolicy = sched_getscheduler (pd->tid);
- if (pd->schedpolicy == -1)
- result = 1;
- else
- pd->flags |= ATTR_FLAG_POLICY_SET;
- }
- if (result == 0)
- {
- *policy = pd->schedpolicy;
- memcpy (param, &pd->schedparam, sizeof (struct sched_param));
- }
- lll_unlock (pd->lock, LLL_PRIVATE);
- return result;
- }
- strong_alias (__pthread_getschedparam, pthread_getschedparam)
|