Created
August 8, 2016 11:26
-
-
Save njlr/89738bb95babef1a8051e4008a38897c to your computer and use it in GitHub Desktop.
A quick example of how to sleep the current thread in C++
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <thread> | |
#include <chrono> | |
using namespace std::literals::chrono_literals; | |
for (int i = 0; i < 5; i++) { | |
std::cout << "Zzz... " << std::endl; | |
std::this_thread::sleep_for(1s); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment