async timer
$ git clone https://github.com/DaveyLaser/hourglass.git
$ cd hourglass
$ mkdir build && cd build
$ cmake ..
$ make
$ cd examples/hello
$ mkdir build && cd build && cmake .. && make
$ ./hello
#include <iostream>
#include "timer.hpp"
struct Observer
{
Observer() : count( 0 ) {}
int count;
void cb ()
{
std::cout << "Hello world, for the " << count++ << "th time!\n";
}
};
int main()
{
Observer o;
hourglass::Timer t;
t.connect( o, &Observer::cb );
t.start( 200 /*ms*/ );
hourglass::sleep( hourglass::seconds( 1 ) );
}