MCPcopy Create free account
hub / github.com/brainboxdotcc/DPP / start_timer

Method start_timer

src/dpp/cluster/timer.cpp:30–43  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28std::atomic<timer> next_handle = 1;
29
30timer cluster::start_timer(timer_callback_t on_tick, uint64_t frequency, timer_callback_t on_stop) {
31 timer_t new_timer;
32
33 new_timer.handle = next_handle++;
34 new_timer.next_tick = time(nullptr) + frequency;
35 new_timer.on_tick = std::move(on_tick);
36 new_timer.on_stop = std::move(on_stop);
37 new_timer.frequency = frequency;
38
39 std::lock_guard<std::mutex> l(timer_guard);
40 next_timer.emplace(new_timer);
41
42 return new_timer.handle;
43}
44
45bool cluster::stop_timer(timer t) {
46 /*

Callers 13

mainFunction · 0.80
mainFunction · 0.80
mainFunction · 0.80
mainFunction · 0.80
mainFunction · 0.80
mainFunction · 0.80
mainFunction · 0.80
handle_frameMethod · 0.80
read_loopMethod · 0.80
on_disconnectMethod · 0.80
oneshot_timerMethod · 0.80

Calls 1

emplaceMethod · 0.80

Tested by 1

mainFunction · 0.64