std :: async::future
Struct std::Context
struct Context {
struct Waker waker;
?&TimerQueue timers;
}What poll() gets: the waker of the task being polled, and the services of the executor polling it. Executors fill it in for every poll; a future only reads it (and clones the waker if it needs to keep it).
timers the executor's timer queue (std/async/timer.h): Sleep,
Interval and Timeout register there. null when the executor
has none (Context::from_waker), and then sleeping is an error.
io_ the executor's I/O driver (std/async/net.h's IoDriver), or
null: the futures there read it through io_driver(cx).
exec_, spawn_ the executor, and its spawn function (see
std/erased.h): what async_spawn uses to start another task
from inside a task. Set by the executor through
context_set_spawn_ (std/async/executor.h).
Fields
Methods
A context with only a waker: no timers, no I/O, no spawning.
A context with Waker::noop(): poll by hand and look at the result.
waker.wake_by_ref(): "poll me again soon"
Releases the waker. A Context owns its waker (a Drop value), so the executor that made one drops it after the poll.