VLink  2.0.0
A high-performance communication middleware
vlink::Schedule::Status类 参考

RAII handle returned by exec_task() when the wrapped callback returns void. 更多...

#include <schedule.h>

类 vlink::Schedule::Status 继承关系图:
vlink::Schedule::Status 的协作图:

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
 
Statusoperator= (const Status &)=delete
 
 Status (Status &&status) noexcept
 Move-constructs from status, transferring its task state. 更多...
 
Statusoperator= (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. 更多...
 
Statuson_schedule_timeout (Callback &&callback)
 Installs the callback fired when the task missed its scheduling deadline. 更多...
 
Statuson_execution_timeout (Callback &&callback)
 Installs the callback fired when a chained callback exceeds execution_timeout_ms. 更多...
 
Statuson_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< Implimpl_
 
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.

构造及析构函数说明

◆ Status() [1/3]

vlink::Schedule::Status::Status ( )

Constructs a fresh handle backed by a newly allocated task state.

◆ ~Status()

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.

◆ Status() [2/3]

vlink::Schedule::Status::Status ( const Status )
delete

◆ Status() [3/3]

vlink::Schedule::Status::Status ( Status &&  status)
noexcept

Move-constructs from status, transferring its task state.

参数
statusSource handle to move from.

成员函数说明

◆ commit()

void vlink::Schedule::Status::commit ( )
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.

◆ dispatch()

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.

◆ is_valid()

bool vlink::Schedule::Status::is_valid ( ) const

Reports whether the wrapped task was successfully posted.

返回
true when the handle refers to a queued task.

◆ on_catch()

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.

参数
callbackHook receiving the caught exception.
返回
Reference to *this for fluent chaining.

◆ on_execution_timeout()

Status& vlink::Schedule::Status::on_execution_timeout ( Callback &&  callback)

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.

参数
callbackHook invoked on the dispatcher thread.
返回
Reference to *this for fluent chaining.

◆ on_schedule_timeout()

Status& vlink::Schedule::Status::on_schedule_timeout ( Callback &&  callback)

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.

参数
callbackHook invoked on the dispatcher thread.
返回
Reference to *this for fluent chaining.

◆ operator=() [1/2]

Status& vlink::Schedule::Status::operator= ( const Status )
delete

◆ operator=() [2/2]

Status& vlink::Schedule::Status::operator= ( Status &&  status)
noexcept

Move-assigns from status, transferring its task state.

参数
statusSource handle to move from.
返回
Reference to *this.

◆ set_valid()

void vlink::Schedule::Status::set_valid ( bool  valid)

Marks whether the handle's underlying task was successfully posted.

参数
validtrue once the task is queued.

类成员变量说明

◆ committed_

bool vlink::Schedule::Status::committed_ {false}
protected

◆ impl_

std::shared_ptr<Impl> vlink::Schedule::Status::impl_
protected

◆ launcher_

Callback vlink::Schedule::Status::launcher_
protected

◆ MessageLoop

friend vlink::Schedule::Status::MessageLoop
protected

◆ Schedule

friend vlink::Schedule::Status::Schedule
protected

该类的文档由以下文件生成: