1 #if !defined(_BTKUTILS_TIMER_HPP_) 2 #define _BTKUTILS_TIMER_HPP_ 8 template<
class Callable,
class ...Args>
11 static void Run(
void *__self){
13 std::apply(self->callable,std::forward<std::tuple<Args...>&&>(*
self));
15 static void Delete(
void *
self){
30 Timer& set_interval(Uint32 interval);
34 template<
class Callable,
class ...Args>
35 Timer& set_callback(Callable &&callable,Args &&...args){
37 void *invoker =
new Invoker{
38 {std::forward<Args>(args)...},
39 std::forward<Callable>(callable)
60 Uint32 interval()
const;
63 Timer& set_interval(std::chrono::milliseconds ms){
64 return set_interval(ms.count());
71 static Uint32 current();
73 typedef void (*InvokerRunFn)(
void*);
74 typedef void (*InvokerCleanupFn)(
void*);
79 void set_invoker(InvokerRunFn,InvokerCleanupFn,
void*);
93 template<
class Callable,
class ...Args>
94 void TimeoutCall(Uint32 interval,Callable &&callable,Args &&...args){
101 #endif // _BTKUTILS_TIMER_HPP_ The Timer Impl.
Definition: timer.cpp:41
This header include many useful containers.
Definition: async.hpp:7