Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ pthread_yield(3) — OSF/1 X2.0-8 MIPS

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

pthread_attr_setsched(3)

pthread_setscheduler(3)

pthread_yield(3)  —  Subroutines

Digital

NAME

pthread_yield − Notifies the scheduler that the current thread is willing to release its processor to other threads of the same or higher priority. 

SYNOPSIS

#include <pthread.h>
void pthread_yield( );

PARAMETERS

None. 

DESCRIPTION

This service 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 service.) 

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

This service allows knowledge of the details of an application to be used to increase fairness. It increases fairness of access to the processor 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 service 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 counter-productive for a thread to yield while it has a needed resource locked. 

RETURN VALUES

None. 

RELATED INFORMATION

pthread_attr_setsched(3), pthread_setscheduler(3)

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026