Module task

Source
Expand description

Tools for working with tasks.

This module contains:

  • Context, which provides contextual data present for every task, including a handle for waking up the task.

  • Waker, a handle for waking up a task.

  • LocalKey, a key for task-local data; you should use the task_local macro to set up such keys.

Tasks themselves are generally created by spawning a future onto an executor. However, you can manually construct a task by creating your own Context instance, and polling a future with it.

The remaining types and traits in the module are used for implementing executors or dealing with synchronization issues around task wakeup.

Structs§

AtomicWaker
A synchronization primitive for task wakeup.
Context
Information about the currently-running task.
LocalKey
A key for task-local data stored in a future’s task.
LocalMap
A map storing task-local data.
Waker
A Waker is a handle for waking up a task by notifying its executor that it is ready to be run.

Traits§

UnsafeWake
An unsafe trait for implementing custom memory management for a Waker.
Wake
A way of waking up a specific task.