This routine sets the scheduling policy of a thread that is created using the attributes object specified by the attr argument. The default value of the scheduling attribute is SCHED_ OTHER. By default, a created thread inherits the policy of the thread calling pthread_create(). To specify a policy using this routine, scheduling inheritance must be disabled at the time the thread is created. Before calling pthread_create(), call pthread_attr_ setinheritsched() and specify the value PTHREAD_EXPLICIT_SCHED for the inherit argument. Preemption is caused by both scheduling and policy. Never attempt to use scheduling as a mechanism for synchronization.