NAME

pthread_setschedparam, pthread_getschedparam - dynamic access to thread scheduling

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 );

Both are callable from an ISR.

DESCRIPTION

Thread scheduling is controlled by a relative scheduling priority. Higher priority threads are scheduled before lower priority threads. Priority is inherited across a thread create, however the priority can be modified at creation time by a call to pthread_attr_setschedparam().

The pthread_setschedparam() function sets the scheduling policy and related scheduling priority for the thread ID given by target_thread to the policy and associated priority provided in policy , and the sched_priority member of param , respectively.

No scheduling parameters are changed for the target thread if pthread_setschedparam() fails.

The pthread_getschedparam() function retrieves the scheduling policy and scheduling priority parameters for the thread ID given by target_thread , and then stores the values in policy and the sched_priority member of param , respectively.

RETURN VALUES

Zero is returned upon successful completion; otherwise, an error number is returned.

ERRORS

For each of the following conditions, these functions return an error number if the condition is detected.

ESRCH
The value specified by target_thread does not refer to an existing thread.
EINVAL
The value of priority is less than or equal to 0 or greater than PTHREAD_PRIO_MAX.

SEE ALSO

pthread_attr_init(), pthread_create()

NOTES

Currently, the policy value is ignored.

Home page (Kernel)


< Copyright Rowebots Research Inc. and Multiprocessor Toolsmiths Inc. 1987-2018 >