just::thread Complete C++ Standard Thread Library by Just Software Solutions

Documentation Home >> Headers >> <thread> Header >> std::this_thread >> std::this_thread::sleep_for Non Member Function

Suspend execution of the current thread for the specified duration.

template<typename Rep,typename Period>
void sleep_for(
    std::chrono::duration<Rep,Period> const&
    relative_time);

Effects:

Blocks the current thread until the specified relative_time has elapsed.

Note:

The thread may be blocked for longer than the specified duration. Where possible, the elapsed time is determined by a steady clock.

Throws:

Nothing

Header

#include <thread>

See Also