MCPcopy Create free account
hub / github.com/IronsDu/brynet / runAfter

Method runAfter

include/brynet/net/EventLoop.hpp:285–305  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

283 }
284
285 brynet::base::Timer::WeakPtr runAfter(std::chrono::nanoseconds timeout, UserFunctor&& callback)
286 {
287 auto timer = std::make_shared<brynet::base::Timer>(
288 std::chrono::steady_clock::now(),
289 std::chrono::nanoseconds(timeout),
290 std::move(callback));
291
292 if (isInLoopThread())
293 {
294 mTimer->addTimer(timer);
295 }
296 else
297 {
298 auto timerMgr = mTimer;
299 runAsyncFunctor([timerMgr, timer]() {
300 timerMgr->addTimer(timer);
301 });
302 }
303
304 return timer;
305 }
306
307 brynet::base::RepeatTimer::Ptr runIntervalTimer(std::chrono::nanoseconds timeout, UserFunctor&& callback)
308 {

Callers 1

startPingCheckTimerFunction · 0.80

Calls 2

nowClass · 0.85
addTimerMethod · 0.80

Tested by

no test coverage detected