MCPcopy Create free account
hub / github.com/davisking/dlib / add

Method add

dlib/timer/timer.cpp:63–92  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

61// ----------------------------------------------------------------------------------------
62
63 void timer_global_clock::
64 add (
65 timer_base* r
66 )
67 {
68 if (r->in_global_clock == false)
69 {
70 // if the thread isn't running then start it up
71 if (!running)
72 {
73 start();
74 running = true;
75 }
76
77 uint64 t = ts.get_timestamp() + r->delay*1000;
78 tm.reset();
79 if (!tm.move_next() || t < tm.element().key())
80 {
81 // we need to make the thread adjust its next time to
82 // trigger if this new event occurrs sooner than the
83 // next event in tm
84 s.signal();
85 }
86 timer_base* rtemp = r;
87 uint64 ttemp = t;
88 tm.add(ttemp,rtemp);
89 r->next_time_to_run = t;
90 r->in_global_clock = true;
91 }
92 }
93
94// ----------------------------------------------------------------------------------------
95

Callers

nothing calls this directly

Calls 6

startFunction · 0.85
get_timestampMethod · 0.80
resetMethod · 0.45
move_nextMethod · 0.45
signalMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected