class pending_task

Defined at line 1366 of file ../../sdk/lib/fit-promise/include/lib/fpromise/promise.h

A pending task holds a |fpromise::promise| that can be scheduled to run on

a |fpromise::executor| using |fpromise::executor::schedule_task()|.

An executor repeatedly invokes a pending task until it returns true,

indicating completion. Note that the promise's resulting value or error

is discarded since it is not meaningful to the executor. If you need

to consume the result, use a combinator such as |fpromise::pending::then()|

to capture it prior to wrapping the promise into a pending task.

See documentation of |fpromise::promise| for more information.

Public Methods

void pending_task ()

Creates an empty pending task without a promise.

Defined at line 1372 of file ../../sdk/lib/fit-promise/include/lib/fpromise/promise.h

void pending_task (promise_type promise)

Creates a pending task that wraps an already boxed promise that returns

|fpromise::result

<void

, void>|.

Defined at line 1376 of file ../../sdk/lib/fit-promise/include/lib/fpromise/promise.h

template <typename Continuation>
void pending_task (promise_impl<Continuation> promise)

Creates a pending task that wraps any kind of promise, boxed or unboxed,

regardless of its result type and with any context that is assignable

from this task's context type.

Defined at line 1382 of file ../../sdk/lib/fit-promise/include/lib/fpromise/promise.h

void pending_task (pending_task && )

Defined at line 1385 of file ../../sdk/lib/fit-promise/include/lib/fpromise/promise.h

pending_task & operator= (pending_task && )

Defined at line 1386 of file ../../sdk/lib/fit-promise/include/lib/fpromise/promise.h

void ~pending_task ()

Destroys the pending task, releasing its promise.

Defined at line 1389 of file ../../sdk/lib/fit-promise/include/lib/fpromise/promise.h

bool operator bool ()

Returns true if the pending task is non-empty (has a valid promise).

Defined at line 1392 of file ../../sdk/lib/fit-promise/include/lib/fpromise/promise.h

bool operator() (fpromise::context & context)

Evaluates the pending task.

If the task completes (returns a non-pending result), the task reverts

to an empty state (because the promise it holds has reverted to an empty

state) and returns true.

It is an error to invoke this method if the pending task is empty.

Defined at line 1399 of file ../../sdk/lib/fit-promise/include/lib/fpromise/promise.h

promise_type take_promise ()

Extracts the pending task's promise.

Defined at line 1402 of file ../../sdk/lib/fit-promise/include/lib/fpromise/promise.h

void pending_task (const pending_task & )

Defined at line 1404 of file ../../sdk/lib/fit-promise/include/lib/fpromise/promise.h

pending_task & operator= (const pending_task & )

Defined at line 1405 of file ../../sdk/lib/fit-promise/include/lib/fpromise/promise.h