Async  1.5.0
AsyncTimer_demo.cpp

An example of how to use the Async::Timer class

#include <iostream>
#include <AsyncTimer.h>
using namespace std;
using namespace Async;
class MyClass : public sigc::trackable
{
public:
MyClass(void) : count(0)
{
timer = new Timer(1000, Timer::TYPE_PERIODIC);
timer->expired.connect(mem_fun(*this, &MyClass::onTimerExpired));
}
~MyClass(void)
{
delete timer;
}
private:
Timer * timer;
int count;
void onTimerExpired(Timer *t)
{
if (++count == 3)
{
Application::app().quit();
}
cout << "Timer expired " << count << "...\n";
}
};
int main(int argc, char **argv)
{
MyClass my_class;
app.exec();
}