oa::Task

oa::Task <T > — lightweight async result (future/promise). producer calls complete(value) or fail(status) exactly once. consumer calls wait() or tryGet() to retrieve the result. Supports then() for continuation chaining. usage: auto task = oa::makeShared <oa ::Task <oa ::Matrix>>(); pool.submitTask([task] { task->complete(computeSomething()); }); auto result = task->wait(); // blocks until complete

Public Methods

void oa::Task::complete(T inValue)
void oa::Task::fail(oa::Status inError)
oa::Status oa::Task::getError()
bool oa::Task::hasFailed()
bool oa::Task::isDone()
oa::SharedPtr<Task<decltype(inFunc(oa::declval<T>()))>> oa::Task::then(F inFunc)
oa::Optional<T> oa::Task::tryGet()
oa::Optional<T> oa::Task::wait()
void oa::Task::complete()
void oa::Task::wait()

Public Method Documentation

void oa::Task::complete( T inValue )
No public source comment is attached to this declaration.

Parameters

inValue
T

Returns

void

The declared return value.

void oa::Task::fail( oa::Status inError )
No public source comment is attached to this declaration.

Parameters

inError
oa::Status

Returns

void

The declared return value.

oa::Status oa::Task::getError()
No public source comment is attached to this declaration.

Returns

oa::Status

The declared return value.

bool oa::Task::hasFailed()
No public source comment is attached to this declaration.

Returns

bool

The declared return value.

bool oa::Task::isDone()
No public source comment is attached to this declaration.

Returns

bool

The declared return value.

oa::SharedPtr<Task<decltype(inFunc(oa::declval<T>()))>> oa::Task::then( F inFunc )
No public source comment is attached to this declaration.

Parameters

inFunc
F

Returns

oa::SharedPtr<Task<decltype(inFunc(oa::declval<T>()))>>

The declared return value.

oa::Optional<T> oa::Task::tryGet()
No public source comment is attached to this declaration.

Returns

oa::Optional<T>

The declared return value.

oa::Optional<T> oa::Task::wait()
No public source comment is attached to this declaration.

Returns

oa::Optional<T>

The declared return value.

void oa::Task::complete()
No public source comment is attached to this declaration.

Returns

void

The declared return value.

void oa::Task::wait()
No public source comment is attached to this declaration.

Returns

void

The declared return value.