Changes the inherit scheduling attribute of the specified thread attributes object.
pthread_attr_setinheritsched( attr, inheritsched );
Argument Data Type Accessattr opaque pthread_attr_t write inheritsched integer read
#includeint pthread_attr_setinheritsched ( pthread_attr_t *attr, int inheritsched);
PTHREAD_INHERIT_SCHED The created thread inherits the scheduling policy and associated scheduling attributes of the thread calling pthread_create. Any scheduling attributes in the attributes object specified by the pthread_create attr argument are ignored during thread creation. This is the default value. PTHREAD_EXPLICIT_SCHED The scheduling policy and associated scheduling attributes of the created thread are set to the corresponding values from the attribute object specified by the pthread_create attr argument.
The first thread in an application has a scheduling policy of SCHED_OTHER. See the pthread_attr_setschedparam and pthread_attr_ setschedpolicy routines for more information on valid priority values and valid scheduling policy values, respectively.
Inheriting scheduling attributes (instead of using the scheduling attributes stored in the attributes object) is useful when a thread is creating several helper threads-threads that are intended to work closely with the creating thread to cooperatively solve the same problem. For example, inherited scheduling attributes ensure that helper threads created in a sort routine execute with the same priority as the calling thread.
Return Description0 Successful completion. [EINVAL] One or both of the values specified by inherit or by attr is invalid. [ENOTSUP] An attempt was made to set the attribute to an unsupported value.
pthread_attr_init pthread_attr_getinheritsched pthread_attr_setschedpolicy pthread_attr_setschedparam pthread_create