Programming1 min readWikipedia, updated 30 May 2026
Yield (multithreading)
Concept in multithreading
In computer science, yield is an action that occurs in a computer program during multithreading, of forcing a processor to relinquish control of the current running thread, and sending it to the end of the running queue, of the same scheduling priority.
Examples
Different programming languages implement yielding in various ways.
pthread_yield()in the language C, a low level implementation, provided by POSIX Threadsstd::this_thread::yield()in the language C++, introduced in C++11.- The Yield method is provided in various object-oriented programming languages with multithreading support, such as C# and Java. OOP languages generally provide class abstractions for thread objects.
yieldin Kotlinsched_yield()in the C standard library, which causes the calling thread to relinquish the CPU.
In coroutines
Coroutines are a fine-grained concurrency primitive, which may be required to yield explicitly. They may enable specifying another function to take control. Coroutines that explicitly yield allow cooperative multitasking.
Adapted from the Wikipedia article, CC BY-SA 4.0. Continue on Wikipedia
Go deeper
Ideas this article links to.
- Speculative multithreadingComputer runtime parallelization technique
- Temporal multithreadingConcept in computer hardware
- Simultaneous multithreadingEfficiency improving technique for superscalar CPUs
- Software lockoutOperating system performance issue
- Simultaneous and heterogeneous multithreadingSoftware framework for heterogeneous computing systems