HELPLIB.HLB  —  DCE  DCE_THREADS, Application Routines, pthread_yield
 NAME

    pthread_yield - Notifies the scheduler that the current thread
                    is willing to release its processor

 SYNOPSIS

     #include <pthread.h>

     void pthread_yield();

 DESCRIPTION

 The pthread_yield() routine notifies the scheduler that the current
 thread is willing to release its processor to other threads of the same
 priority. (A thread releases its processor to a thread of a higher
 priority without calling this routine.)

 If the current thread's scheduling policy (as specified in a call to the
 pthread_attr_setsched() or pthread_setscheduler() routine) is SCHED_FIFO
 or SCHED_RR, this routine yields the processor to other threads of the
 same or a higher priority. If no threads of the same priority are ready
 to execute, the thread continues.

 This routine allows knowledge of the details of an application to be
 used to increase fairness. It increases fairness of access to the pro-
 cessor by removing the current thread from the processor. It also
 increases  fairness of access to shared resources by removing the
 current thread from the processor as soon as it is finished with the
 resource.

 Call this routine when a thread is executing code that denies access to
 other threads on a uniprocessor if the scheduling policy is SCHED_FIFO.

 Use pthread_yield() carefully because misuse causes unnecessary context
 switching, which increases overhead without increasing fairness. For
 example, it is counterproductive for a thread to yield while it has a
 needed resource locked.

 RETURN VALUES

 No value is returned.

 RELATED INFORMATION

     FUNCTIONS:  pthread_attr_setsched
                 pthread_setscheduler
Close Help