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

Function main

examples/timer_ex.cpp:33–53  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31// ----------------------------------------------------------------------------------------
32
33int main()
34{
35 timer_example e;
36
37 // Here we construct our timer object. It needs two things. The second argument is
38 // the member function it is going to call at regular intervals and the first argument
39 // is the object instance it will call that member function on.
40 timer<timer_example> t(e, &timer_example::action_function);
41
42 // Set the timer object to trigger every second
43 t.set_delay_time(1000);
44
45 // Start the timer. It will start calling the action function 1 second from this call
46 // to start.
47 t.start();
48
49 // Sleep for 10 seconds before letting the program end.
50 dlib::sleep(10000);
51
52 // The timer will destruct itself properly and stop calling the action_function.
53}
54
55// ----------------------------------------------------------------------------------------
56

Callers

nothing calls this directly

Calls 1

sleepFunction · 0.50

Tested by

no test coverage detected