Skip to content

Instantly share code, notes, and snippets.

@njlr
Created August 8, 2016 11:26
Show Gist options
  • Save njlr/89738bb95babef1a8051e4008a38897c to your computer and use it in GitHub Desktop.
Save njlr/89738bb95babef1a8051e4008a38897c to your computer and use it in GitHub Desktop.
A quick example of how to sleep the current thread in C++
#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