123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- #include <errno.h>
- #include <string.h>
- #include "pthreadP.h"
- #include <lowlevellock.h>
- int
- __pthread_getschedparam (threadid, policy, param)
- 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;
-
- pthread_cleanup_push ((void (*) (void *)) lll_unlock_wake_cb, &pd->lock);
- lll_lock (pd->lock);
-
- 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);
- pthread_cleanup_pop (0);
- return result;
- }
- strong_alias (__pthread_getschedparam, pthread_getschedparam)
|