Use pthread_attr_setinheritsched(3THR) to set the inherited scheduling policy.
An inherit value of PTHREAD_INHERIT_SCHED (the default) 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 is used, the attributes from the pthread_create() call are to be used.
Prototype: 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);
Returns zero after completing successfully. Any other returned value indicates that an error occurred. When either of the following conditions occurs, the function fails and returns the corresponding value.