include ev include iostream const double kTimeout class Timer public T

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <ev++.h>
#include <iostream>
const double kTimeout = 1.0;
class Timer {
public:
Timer() {
timer.set<Timer, &Timer::TimerCallback>(this);
timer.set(0., kTimeout);
timer.again();
}
private:
void TimerCallback() {
std::cerr << "Timer works!" << std::endl;
}
ev::timer timer;
};
int main(int /*argc*/, char ** /*argv*/) {
Timer a;
ev::default_loop loop;
loop.loop();
return 0;
}