Pigweed
C/C++ API Reference
|
Public Member Functions | |
Context (Dispatcher &dispatcher, Waker &waker) | |
Dispatcher & | dispatcher () |
void | ReEnqueue () |
template<typename T = ReadyType> | |
Poll< T > | Unschedule () |
Friends | |
class | NativeDispatcherBase |
bool | internal::StoreWaker (Context &cx, Waker &waker_out, log::Token wait_reason) |
bool | internal::StoreWaker (Context &cx, internal::WakerQueueBase &queue, log::Token wait_reason) |
Context for an asynchronous Task
.
This object contains resources needed for scheduling asynchronous work, such as the current Dispatcher
and the Waker
for the current task.
Context
s are most often created by Dispatcher
s, which pass them into Task::Pend
.
|
inline |
Creates a new Context
containing the currently-running Dispatcher
and a Waker
for the current Task
.
|
inline |
The Dispatcher
on which the current Task
is executing.
This can be used for spawning new tasks using dispatcher().Post(task);
.
void pw::async2::Context::ReEnqueue | ( | ) |
Queues the current Task::Pend
to run again in the future, possibly after other work is performed.
This may be used by Task
implementations that wish to provide additional fairness by yielding to the dispatch loop rather than perform too much work in a single iteration.
This is semantically equivalent to calling:
|
inline |
Indicates that the task has not completed, but that it also does not need to register a waker and go to sleep. This results in the task being