pthread_yield(3-thr) pthread_yield(3-thr)
NAME
pthreadyield - notifies the scheduler that the current thread is wil-
ling to release its processor
SYNOPSIS
#include <pthread.h>
void pthreadyield();
DESCRIPTION
The pthreadyield() 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 pthreadattrsetsched() or pthreadsetscheduler() routine) is
SCHEDFIFO or SCHEDRR, 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
SCHEDFIFO.
Use pthreadyield() carefully because misuse causes unnecessary con-
text 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.
SEE ALSO
pthreadattrsetsched(3-thr), pthreadsetscheduler(3-thr).
Page 1 Reliant UNIX 5.44 Printed 11/98