14.3. Scheduling Functions

14.3.1. The pthread_getschedparam function

Synopsis
#include <pthread.h>

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

Description

The pthread_setschedparam and pthread_getschedparam functions allow the scheduling policy and scheduling priority parameters to be set and retrieved for individual threads.

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

Returns

The pthread_getschedparam function returns -1 and sets errno if there is an error.

Implementation Notes
See Also
Section 14.3.2

14.3.2. The pthread_setschedparam function

Synopsis
#include <pthread.h>

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

Description

The pthread_setschedparam and pthread_getschedparam functions allow the scheduling policy and scheduling priority parameters to be set and retrieved for individual threads.

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

Returns

The pthread_setschedparam function returns 1 and sets errno in th event of an error.

Implementation Notes
See Also
Section 14.3.1

14.3.3. The sched_get_priority_max function

Synopsis
#include <pthread.h>

int sched_get_priority_max (int policy );

Description

The sched_get_priority_max function returns the first value in the range of priorities for the given policy.

Returns

The sched_get_priority_max function returns the priority.

Implementation Notes

14.3.4. The sched_get_priority_min function

Synopsis
#include <pthread.h>

int sched_get_priority_min (int policy );

Description

The sched_get_priority_min function returns the first value in the range of priorities for the given policy.

Returns

The sched_get_priority_min function returns the priority.

Implementation Notes

14.3.5. The sched_yield function

Synopsis
#include <pthread.h>

int sched_yield ( );

Description

The sched_yield function yields the processor to another thread.

Returns

The sched_yield function returns 0.

Implementation Notes

None.