Wrath of Zeus
Made by Torchlight Games for CSE 125 SP24
Loading...
Searching...
No Matches
timer.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <chrono>
4#include <functional>
5#include <thread>
6#include <iostream>
7
8template< class T, class P >
9void setTimer(std::chrono::duration<T,P> duration, std::function<void()> callback) {
10 std::thread timer([duration, callback]() {
11 std::this_thread::sleep_for(duration);
12 callback();
13 });
14 timer.detach();
15}
void setTimer(std::chrono::duration< T, P > duration, std::function< void()> callback)
Definition: timer.hpp:9