pthread_yield Subroutine
Purpose
Forces the calling thread to relinquish use of its processor.
Library
Threads Library (libpthreads.a
)
Syntax
#include <pthread.h>
void pthread_yield ()
Description
The pthread_yield subroutine forces the calling thread to relinquish use of its processor, and to wait in the run queue before it is scheduled again. If the run queue is empty when the pthread_yield subroutine is called, the calling thread is immediately rescheduled.
If the thread
has global contention scope (PTHREAD_SCOPE_SYSTEM
), calling
this subroutine acts like calling the yield subroutine. Otherwise, another local
contention scope thread is scheduled.
The pthread.h header file must be the first included file of each source
file by using the threads library. Otherwise, the -D_THREAD_SAFE
compilation flag
must be used, or the cc_r compiler used. In this case, the flag is automatically set.