This is a simple example illustrating the usage with an arbitrary member function as an event handler callbacks.
#include <eventxx>
#include <iostream>
#include <csignal>
struct handler
{
dispatcher& d;
int i;
handler(dispatcher& d): d(d), i(0) {}
{
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);
cb_type cb(h, &handler::handle_event);
d.add(e);
d.dispatch();
return 0;
}
type
Type of events.
Definition: eventxx:192
Event dispatcher.
Definition: eventxx:549
Helper functor to use an arbitrary member function as an event handler.
Definition: eventxx:508
Signal event object.
Definition: eventxx:425