NAME | SYNOPSIS | DESCRIPTION | RETURN VALUE | ERRORS | ATTRIBUTES
#include <pthread.h> #include <sched.h>int pthread_setschedparam(pthread_t thread, int policy, const struct sched_param * param);
The pthread_setschedparam and pthread_getschedparam functions respectively modify and retrieve the dynamic scheduling policy and scheduling parameters of individual threads. The only settable parameter for the SCHED_RR and SCHED_FIFO policies (and thus the only member of struct sched_param ) is thread priority (see pthread_attr_setscope (3POSIX)).
The pthread_setschedparam function sets the scheduling policy and scheduling parameters for the thread designated by thread to the policy and parameters provided in policy and param , respectively. The value of policy may be either SCHED_RR, SCHED_FIFO, or SCHED_OTHER which is equivalent to SCHED_RR. Thread priority is stored in the sched_priority member of param .
The pthread_getschedparam function retrieves the scheduling policy and scheduling parameters for the thread designated by thread , and stores those values in policy and param , respectively. The policy and priority returned by pthread_getschedparam are the values specified by the most recent pthread_setschedparam or pthread_create call affecting the target thread.
Upon successful completion, pthread_setschedparam and pthread_getschedparam return zero. Otherwise an error code is returned. (NOTE: These calls do not set errno .)
The thread argument is not a valid thread identifier. Either the policy or the param argument contains an invalid value ( pthread_setschedparam only).
No active thread corresponding to the identifier thread was found.
See attributes(5) for descriptions of the following attributes:
ATTRIBUTE TYPE | ATTRIBUTE VALUE |
---|---|
Interface Stability | Evolving |
NAME | SYNOPSIS | DESCRIPTION | RETURN VALUE | ERRORS | ATTRIBUTES