Sets the value of the schedparam attribute of a thread attributes object.
Threads Library (libpthreads.a)
#include <pthread.h>
#include <sys/sched.h>
int pthread_attr_setschedparam (attr, schedparam)
pthread_attr_t *attr;
const struct sched_param *schedparam;
The pthread_attr_setschedparam subroutine sets the value of the schedparam attribute of the thread attributes object attr. The schedparam attribute specifies the scheduling parameters of a thread created with this attributes object. The sched_priority field of the sched_param structure contains the priority of the thread.
Item | Description |
---|---|
attr | Specifies the thread attributes object. |
schedparam | Points to where the scheduling parameters to set are stored. The sched_priority field must be in the range from 1 to 127, where 1 is the least favored priority, and 127 the most favored. |
Upon successful completion, 0 is returned. Otherwise, an error code is returned.
The pthread_attr_setschedparam subroutine is unsuccessful if the following is true:
Item | Description |
---|---|
EINVAL | The attr parameter is not valid. |
ENOSYS | The priority scheduling POSIX option is not implemented. |
ENOTSUP | The value of the schedparam attribute is not supported. |