123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- #include <assert.h>
- #include <errno.h>
- #include <string.h>
- #include "pthreadP.h"
- int
- attribute_protected
- __pthread_attr_setschedparam (
- pthread_attr_t *attr,
- const struct sched_param *param)
- {
- assert (sizeof (*attr) >= sizeof (struct pthread_attr));
- struct pthread_attr *iattr = (struct pthread_attr *) attr;
- int min = sched_get_priority_min (iattr->schedpolicy);
- int max = sched_get_priority_max (iattr->schedpolicy);
- if (min == -1 || max == -1
- || param->sched_priority > max || param->sched_priority < min)
- return EINVAL;
-
- memcpy (&iattr->schedparam, param, sizeof (struct sched_param));
-
- iattr->flags |= ATTR_FLAG_SCHED_SET;
- return 0;
- }
- strong_alias (__pthread_attr_setschedparam, pthread_attr_setschedparam)
|