class context
Defined at line 1426 of file ../../sdk/lib/fit-promise/include/lib/fpromise/promise.h
Execution context for an asynchronous task, such as a |fpromise::promise|,
|fpromise::future|, or |fpromise::pending_task|.
When a |fpromise::executor| executes a task, it provides the task with an
execution context which enables the task to communicate with the
executor and manage its own lifecycle. Specialized executors may subclass
|fpromise::context| and offer additional methods beyond those which are
defined here, such as to provide access to platform-specific features
supported by the executor.
The context provided to a task is only valid within the scope of a single
invocation; the task must not retain a reference to the context across
invocations.
See documentation of |fpromise::promise| for more information.
Public Methods
template <typename Context, typename = std::enable_if_t<std::is_base_of<context, Context>::value>>
Context & as ()
Converts this context to a derived context type.
Defined at line 1440 of file ../../sdk/lib/fit-promise/include/lib/fpromise/promise.h
class executor * executor ()
Gets the executor that is running the task, never null.
suspended_task suspend_task ()
Obtains a handle that can be used to resume the task after it has been
suspended.
Clients should call this method before returning |fpromise::pending()| from
the task. See documentation on |fpromise::executor|.
Protected Methods
void ~context ()
Defined at line 1447 of file ../../sdk/lib/fit-promise/include/lib/fpromise/promise.h