1 #ifndef LIBFILEZILLA_INVOKER_HEADER 2 #define LIBFILEZILLA_INVOKER_HEADER 13 struct invoker_event_type{};
16 typedef simple_event<invoker_event_type, std::function<void()>> invoker_event;
19 class FZ_PUBLIC_SYMBOL thread_invoker final :
public event_handler
22 thread_invoker(event_loop& loop);
23 virtual ~thread_invoker();
25 virtual void operator()(event_base
const& ev)
override;
38 return [handler = thread_invoker(loop), cf = std::forward<F>(f)](
auto &&... args)
mutable -> decltype(f(std::forward<decltype(args)>(args)...),
void())
40 auto cb = [cf = std::move(cf), targs = std::make_tuple(std::forward<decltype(args)>(args)...)] {
54 typedef std::function<void(std::function<void()>)> invoker_factory;
74 return [inv, cf = std::forward<F>(f)](
auto &&... args)
mutable -> decltype(f(std::forward<decltype(args)>(args)...),
void())
76 auto cb = [cf = std::move(cf), targs = std::make_tuple(std::forward<decltype(args)>(args)...)] {
auto apply(Obj &&obj, F &&f, Tuple &&args) -> decltype(apply_(std::forward< Obj >(obj), std::forward< F >(f), std::forward< Tuple >(args), Seq()))
Apply tuple to pointer to member.
Definition: apply.hpp:48
Declares the event_handler class.
This is the recommended event class.
Definition: event.hpp:65
A threaded event loop that supports sending events and timers.
Definition: event_loop.hpp:33
The namespace used by libfilezilla.
Definition: apply.hpp:17
invoker_factory get_invoker_factory(event_loop &loop)
Creates an invoker factory.
auto make_invoker(event_loop &loop, F &&f)
Wraps the passed function, so that it is always invoked in the context of the loop.
Definition: invoker.hpp:36