Yield (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 Threads[1]std::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.[2] OOP languages generally provide class abstractions for thread objects.
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.
gollark: I use pipes as my pipes.
gollark: ```THE KNOWLEDGE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF UNLEASHING INDESCRIBABLE HORRORS THAT SHATTER YOUR PSYCHE AND SET YOUR MIND ADRIFT IN THE UNKNOWABLY INFINITE COSMOS.```Quote from some documentation.
gollark: Anyway, if you have a design for an inscriber setup which scales better than my existing one, please do share it.
gollark: Yep.
gollark: I assume it interpreted "no items in filter slot" as "just allow anything in".
See also
References
- "pthread_yield".
- "Thread.yield". Javamex. Retrieved 24 June 2011.
This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.