Reputation: 4631
I want to wake up my threads a specified time. Can I do it like this?
#include <chrono>
#include <thread>
using namespace std::literals::chrono_literals;
void foo() {}
int main()
{
using clock = std::chrono::steady_clock;
clock::time_point next_time_point = clock::now() + 20s;
foo();
std::this_thread::sleep_until(next_time_point);
}
Upvotes: 1
Views: 51