#include <iostream>
#include <string>
#include <vector>
struct my_event_type;
{
public:
{}
virtual ~handler()
{
}
private:
{
fz::dispatch<my_event>(ev, this, &handler::on_my_event);
}
void on_my_event(std::string const& s, std::vector<int> const& v)
{
std::cout << "Received event with text \"" << s << "\" and a vector with " << v.size() << " elements" << std::endl;
}
};
int main()
{
handler h(l);
h.send_event<my_event>("Hello World!", std::vector<int>{23, 42, 666});
return 0;
}
Waitable condition variable.
Definition: mutex.hpp:196
void wait(scoped_lock &l)
Wait indefinitely for condition to become signalled.
void signal(scoped_lock &l)
Signal condition variable.
Common base class for all events.
Definition: event.hpp:23
Simple handler for asynchronous event processing.
Definition: event_handler.hpp:55
void remove_handler()
Deactivates handler, removes all pending events and stops all timers for this handler.
virtual void operator()(event_base const &)=0
Called by the event loop in the worker thread with the event to process.
A threaded event loop that supports sending events and timers.
Definition: event_loop.hpp:34
Lean replacement for std::(recursive_)mutex.
Definition: mutex.hpp:52
A simple scoped lock.
Definition: mutex.hpp:93
This is the recommended event class.
Definition: event.hpp:68
Declares the event_handler class.
The namespace used by libfilezilla.
Definition: apply.hpp:17