Multithreaded Programming Guide

Set Inherited Scheduling Policy


Use pthread_attr_setinheritsched(3THR) to set the inherited scheduling policy.

An inherit value of PTHREAD_INHERIT_SCHED means that the scheduling policies defined in the creating thread are to be used, and any scheduling attributes defined in the pthread_create() call are to be ignored. If PTHREAD_EXPLICIT_SCHED (the default) is used, the attributes from the pthread_create() call are to be used.


int	pthread_attr_setinheritsched(pthread_attr_t *tattr, int inherit);
#include <pthread.h>

pthread_attr_t tattr;
int inherit;
int ret;

/* use the current scheduling policy */
ret = pthread_attr_setinheritsched(&tattr, PTHREAD_EXPLICIT_SCHED);

Return Values

pthread_attr_setinheritsched() returns zero after completing successfully. Any other return value indicates that an error occurred. When either of the following conditions occurs, the function fails and returns the corresponding value.


An attempt was made to set tattr to a value that is not valid.


An attempt was made to set the attribute to an unsupported value.