Example #1
0
 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;
 }
Example #2
0
 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;
 }