std::shared_ptr<Timer> set_interval(EventLoop& loop, time_t interval, std::function<void ()> cb) { auto timer = std::make_shared<Timer>(loop.c_obj(), cb); timer->self = timer; timer->start(interval, interval); return timer; }
std::shared_ptr<Timer> set_timeout(EventLoop& loop, time_t timeout, std::function<void ()> cb) { auto timer = std::make_shared<Timer>(loop.c_obj(), cb); timer->self = timer; timer->start(timeout, 0); return timer; }