Async 1.8.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();
}
The core class for writing asyncronous cpp applications.
Contains a single shot or periodic timer that emits a signal on timeout.
An application class for writing non GUI applications.
void exec(void)
Execute the application main loop.
A class that produces timer events.
Definition AsyncTimer.h:117
Namespace for the asynchronous programming classes.