std::this_thread::yield (3) - Linux Manuals
std::this_thread::yield: std::this_thread::yield
NAME
std::this_thread::yield - std::this_thread::yield
Synopsis
Defined in header <thread>
void yield() noexcept; (since C++11)
Provides a hint to the implementation to reschedule the execution of threads, allowing other threads to run.
Parameters
(none)
Return value
(none)
Notes
The exact behavior of this function depends on the implementation, in particular on the mechanics of the OS scheduler in use and the state of the system. For example, a first-in-first-out realtime scheduler (SCHED_FIFO in Linux) would suspend the current thread and put it on the back of the queue of the same-priority threads that are ready to run (and if there are no other threads at the same priority, yield has no effect).
Example
// Run this code
Possible output: