|
VLink
2.0.0
A high-performance communication middleware
|
RAII handle returned by exec_task() when the wrapped callback returns void.
更多...
#include <schedule.h>
类 | |
| struct | Impl |
Public 成员函数 | |
| Status () | |
| Constructs a fresh handle backed by a newly allocated task state. 更多... | |
| ~Status () | |
| Destroys the handle reference, committing the configuration so the task may dispatch. 更多... | |
| Status (const Status &)=delete | |
| Status & | operator= (const Status &)=delete |
| Status (Status &&status) noexcept | |
Move-constructs from status, transferring its task state. 更多... | |
| Status & | operator= (Status &&status) noexcept |
Move-assigns from status, transferring its task state. 更多... | |
| void | set_valid (bool valid) |
| Marks whether the handle's underlying task was successfully posted. 更多... | |
| bool | is_valid () const |
| Reports whether the wrapped task was successfully posted. 更多... | |
| bool | dispatch () |
| Commits the configuration immediately and reports whether the task was posted. 更多... | |
| Status & | on_schedule_timeout (Callback &&callback) |
| Installs the callback fired when the task missed its scheduling deadline. 更多... | |
| Status & | on_execution_timeout (Callback &&callback) |
Installs the callback fired when a chained callback exceeds execution_timeout_ms. 更多... | |
| Status & | on_catch (CatchCallback &&callback) |
Installs the callback fired when the task throws a std::exception. 更多... | |
Protected 成员函数 | |
| void | commit () noexcept |
| Runs the installed launcher exactly once, posting the wrapped task to its dispatcher. 更多... | |
Protected 属性 | |
| friend | Schedule |
| friend | MessageLoop |
| std::shared_ptr< Impl > | impl_ |
| Callback | launcher_ |
| bool | committed_ {false} |
RAII handle returned by exec_task() when the wrapped callback returns void.
Holds a shared reference to the underlying task state. Continuation callbacks may be attached in any order before the configuration is committed; the wrapped task is not dispatched until commit, which happens when the originating handle is destroyed (i.e. the end of the fluent expression) or when dispatch() is called explicitly. Every callback attached before commit is therefore guaranteed to be registered before the task runs; attachments after commit are ignored. Committing does not cancel the task; it posts it.
| vlink::Schedule::Status::Status | ( | ) |
Constructs a fresh handle backed by a newly allocated task state.
| vlink::Schedule::Status::~Status | ( | ) |
Destroys the handle reference, committing the configuration so the task may dispatch.
Commits the pending configuration: once the originating handle is gone no further continuation callbacks can be attached, so the dispatcher is released to run the task with the full callback chain in place. Does not cancel the task.
|
delete |
|
noexcept |
Move-constructs from status, transferring its task state.
| status | Source handle to move from. |
|
protectednoexcept |
Runs the installed launcher exactly once, posting the wrapped task to its dispatcher.
Posting is deferred until the handle is committed so every fluent continuation is registered before the task is enqueued. The launcher lives in the handle (not the shared state), so the post payload is released with the handle and forms no reference cycle. Idempotent and safe on a moved-from handle.
| bool vlink::Schedule::Status::dispatch | ( | ) |
Commits the configuration immediately and reports whether the task was posted.
The task is otherwise posted when the handle is destroyed. A caller that stores the handle instead of consuming it inline calls dispatch() to post it now and learn the result synchronously. Attach all continuations first; idempotent with the destructor.
true when the task was accepted by its dispatcher. | bool vlink::Schedule::Status::is_valid | ( | ) | const |
Reports whether the wrapped task was successfully posted.
true when the handle refers to a queued task. | Status& vlink::Schedule::Status::on_catch | ( | CatchCallback && | callback | ) |
Installs the callback fired when the task throws a std::exception.
Only std::exception-derived failures are caught; other exception types are allowed to propagate. Only one catch callback may be registered.
| callback | Hook receiving the caught exception. |
*this for fluent chaining. Installs the callback fired when a chained callback exceeds execution_timeout_ms.
Triggered after each callback in the chain returns. Only one execution-timeout callback may be registered; late registrations are dropped. Does not interrupt a running callback.
| callback | Hook invoked on the dispatcher thread. |
*this for fluent chaining. Installs the callback fired when the task missed its scheduling deadline.
Triggered once when the task is dequeued and the elapsed time since posting exceeds delay_ms + schedule_timeout_ms. Only one schedule-timeout callback may be registered; late registrations are dropped.
| callback | Hook invoked on the dispatcher thread. |
*this for fluent chaining. Move-assigns from status, transferring its task state.
| status | Source handle to move from. |
*this. | void vlink::Schedule::Status::set_valid | ( | bool | valid | ) |
Marks whether the handle's underlying task was successfully posted.
| valid | true once the task is queued. |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |