24 #ifndef LELY_EV_TASK_HPP_ 25 #define LELY_EV_TASK_HPP_ 40 template <
class Invoker>
43 template <
class F,
class... Args>
47 auto self =
static_cast<TaskWrapper*
>(task);
51 invoker_(::std::forward<F>(f), ::std::forward<Args>(args)...) {}
53 TaskWrapper(
const TaskWrapper&) =
delete;
55 TaskWrapper& operator=(
const TaskWrapper&) =
delete;
67 template <
class F,
class... Args>
75 template <
class F,
class... Args>
79 ::std::forward<Args>(args)...);
88 using Signature = void();
98 auto self =
static_cast<Task*
>(task);
99 if (self->func_)
self->func_();
101 func_(::std::forward<F>(f)) {}
109 Task& operator=(
const Task&) =
delete;
112 Executor get_executor()
const noexcept;
115 ::std::function<Signature> func_;
121 #endif // !LELY_EV_TASK_HPP_ const struct ev_exec_vtbl *const ev_exec_t
An abstract task executor.
TaskWrapper< F, Args... > * make_task_wrapper(ev_exec_t *exec, F &&f, Args &&... args)
Creates a temporary task from a callable object with an associated executor (can be nullptr)...
#define EV_TASK_INIT(exec, func)
The static initializer for ev_task.
Task(ev_exec_t *exec, F &&f)
Constructs a task from a callable object with an associated executor (can be nullptr).
ev_exec_t * exec
A pointer to the executor to which the task is (to be) submitted.
Task(F &&f)
Constructs a task from a callable object.
This header file is part of the event library; it contains the task declarations. ...
An abstract task executor. This class is a wrapper around ev_exec_t*.
This header file is part of the utilities library; it contains a function object that can be used to ...