sched_yield() — Release the processor to other threads

Standards

Standards / Extensions C or C++ Dependencies
Single UNIX Specification, version 3 both

z/OS V1R7
POSIX(ON)

Format

#define _UNIX03_SOURCE
#include <sched.h>

int sched_yield(void);

General description

The sched_yield() function allows a thread to give up control of a processor so that another thread can have the opportunity to run. It takes no arguments.

The speed at which the sched_yield() function releases a processor can be configured by using the _EDC_PTHREAD_YIELD and _EDC_PTHREAD_YIELD_MAX environment variables. The _EDC_PTHREAD_YIELD environment variable is used to configure the sched_yield() function to release the processor immediately, or to release the processor after a delay. The _EDC_PTHREAD_YIELD_MAX environment variable is used to change the maximum delay to a value less than the default (32 milliseconds).

For more information about the _EDC_PTHREAD_YIELD and _EDC_PTHREAD_YIELD_MAX environment variables, see “Using Environment Variables” in z/OS XL C/C++ Programming Guide.

Returned value

sched_yield() always returns 0.

There are no documented errno values. Use perror() or strerror() to determine the cause of the error.

Related information