Table of Contents

Name

pthread_setschedparam, pthread_getschedparam - control thread scheduling

parameters

Synopsis

#include <pthread.h>

int pthread_setschedparam(pthread_t target_thread, int policy, const struct sched_param *param);

int pthread_getschedparam(pthread_t target_thread, int *policy, struct sched_param *param);

Description

pthread_setschedparam sets the scheduling parameters for the thread target_thread as indicated by policy and param. policy can be either SCHED_OTHER (regular, non-real-time scheduling), SCHED_RR (real-time, round-robin) or SCHED_FIFO (real-time, first-in first-out). param specifies the scheduling priority for the two real-time policies. See sched_setpolicy(2) for more information on scheduling policies.

Pthreads-w32 only supports SCHED_OTHER and does not support the real-time scheduling policies SCHED_RR and SCHED_FIFO.

pthread_getschedparam retrieves the scheduling policy and scheduling parameters for the thread target_thread and stores them in the locations pointed to by policy and param, respectively.

Return Value

pthread_setschedparam and pthread_getschedparam return 0 on success and a non-zero error code on error.

Errors

On error, pthread_setschedparam returns the following error codes:

ENOTSUP
policy is not SCHED_OTHER.
EINVAL
One of the arguments is invalid, or the priority value specified by param is not valid for the specified policy.
ESRCH
The target_thread is invalid or has already terminated

On error, pthread_getschedparam returns the following error codes:

ESRCH
the target_thread is invalid or has already terminated

Author

Xavier Leroy <Xavier.Leroy@inria.fr>

Modified by Ross Johnson for use with Pthreads-w32.

See Also

sched_setscheduler(2) , sched_getscheduler(2) , sched_getparam(2) , pthread_attr_setschedpolicy(3) , pthread_attr_setschedparam(3) .


Table of Contents