eventxx  1.0.1
functor-way.cpp

This is a simple example illustrating the usage with function object callbacks.

#include <eventxx>
#include <iostream>
#include <csignal>
struct handler
{
dispatcher& d;
int i;
handler(dispatcher& d): d(d), i(0) {}
void operator() (int signum, eventxx::type event)
{
std::cout << ++i << " interrupts, ";
if (i < 5) std::cout << "keep going...\n";
else
{
std::cout << "done!\n";
d.exit();
}
}
};
int main()
{
dispatcher d;
handler h(d);
d.add(e);
d.dispatch();
return 0;
}
type
Type of events.
Definition: eventxx:192
Event dispatcher.
Definition: eventxx:549
Signal event object.
Definition: eventxx:425