143 explicit Config(uint32_t _delay_ms, uint16_t _priority = 0, uint32_t _schedule_timeout_ms = 0,
144 uint32_t _execution_timeout_ms = 0);
146 uint32_t delay_ms{0};
147 uint16_t priority{0};
148 uint32_t schedule_timeout_ms{0};
149 uint32_t execution_timeout_ms{0};
270 std::atomic_bool dispatched{
false};
292 bool committed_{
false};
305 using Status::Status;
RAII handle returned by exec_task() when the wrapped callback returns bool.
Definition: schedule.h:303
RetStatus & on_then(RetCallback &&callback)
Appends a continuation that runs only when the previous callback returned true.
Status & on_else(Callback &&callback)
Installs the callback fired when the wrapped task returns false.
RAII handle returned by exec_task() when the wrapped callback returns void.
Definition: schedule.h:164
Status & operator=(const Status &)=delete
void commit() noexcept
Runs the installed launcher exactly once, posting the wrapped task to its dispatcher.
Status & on_execution_timeout(Callback &&callback)
Installs the callback fired when a chained callback exceeds execution_timeout_ms.
Status(Status &&status) noexcept
Move-constructs from status, transferring its task state.
friend MessageLoop
Definition: schedule.h:266
Status()
Constructs a fresh handle backed by a newly allocated task state.
friend Schedule
Definition: schedule.h:265
Status & on_schedule_timeout(Callback &&callback)
Installs the callback fired when the task missed its scheduling deadline.
void set_valid(bool valid)
Marks whether the handle's underlying task was successfully posted.
bool dispatch()
Commits the configuration immediately and reports whether the task was posted.
Status & on_catch(CatchCallback &&callback)
Installs the callback fired when the task throws a std::exception.
bool is_valid() const
Reports whether the wrapped task was successfully posted.
Status(const Status &)=delete
Status & operator=(Status &&status) noexcept
Move-assigns from status, transferring its task state.
~Status()
Destroys the handle reference, committing the configuration so the task may dispatch.
Pool-backed type-erased callables: copyable vlink::Function and move-only vlink::MoveFunction.
Cross-platform macros for visibility, branch hints, copy prevention, singletons and string helpers.
#define VLINK_EXPORT
Definition: macros.h:81
constexpr bool is_valid() noexcept
Definition: name_detector.h:382
Scheduling parameters captured at the call to exec_task().
Definition: schedule.h:129
Config()
Constructs a default Config with every field zero-initialised.
Config(uint32_t _delay_ms, uint16_t _priority=0, uint32_t _schedule_timeout_ms=0, uint32_t _execution_timeout_ms=0)
Constructs a fully populated Config.
Definition: schedule.h:268
Callback else_callback
Definition: schedule.h:275
std::recursive_mutex mtx
Definition: schedule.h:271
Callback schedule_timeout_callback
Definition: schedule.h:272
std::vector< RetCallback > then_callback_list
Definition: schedule.h:276
CatchCallback catch_callback
Definition: schedule.h:274
Callback execution_timeout_callback
Definition: schedule.h:273
Non-instantiable container for task-scheduling types and the process() entry points.
Definition: schedule.h:106
Schedule & operator=(Schedule &&)=delete
static Status process(const Config &config, Callback &&callback, Callback &wrapper_callback)
Wraps a void callback in a Config envelope and produces the task wrapper for the dispatcher.
Schedule & operator=(const Schedule &)=delete
Schedule(Schedule &&)=delete
Schedule(const Schedule &)=delete
static RetStatus process_with_ret(const Config &config, RetCallback &&callback, Callback &wrapper_callback)
Wraps a bool-returning callback in a Config envelope and produces the task wrapper for the dispatcher...