Daily bit(e) of C++ | std::this_thread
Daily bit(e) of C++ ♻️150, Querying and yielding the execution of the current thread using the functions in the std::this_thread namespace.
The C++11 std::this_thread is a namespace in the <thread> header that contains functions for querying the current thread ID (get_id()) and yielding the execution of the current thread (yield()), potentially for a specified duration (sleep_for()) or until a time point (sleep_until()).
Note that the actual behaviour of yield, sleep_for and sleep_until depends on the thread library and OS scheduler.