Module task

Source

Modules§

coop
Utilities for improved cooperative scheduling.
futures
Task-related futures.

Structs§

AbortHandle
An owned permission to abort a spawned task, without awaiting its completion.
Id
An opaque ID that uniquely identifies a task relative to all other currently running tasks.
JoinError
Task failed to execute to completion.
JoinHandle
An owned permission to join on a task (await its termination).
JoinSet
A collection of tasks spawned on a Tokio runtime.
LocalEnterGuard
Context guard for LocalSet
LocalKey
A key for task-local data.
LocalSet
A set of tasks which are executed on the same thread.
Unconstrained
Future for the unconstrained method.

Functions§

Runtime
block_in_place
Runs the provided blocking function on the current thread without blocking the executor.
consume_budget
Consumes a unit of budget and returns the execution back to the Tokio runtime if the task’s coop budget was exhausted.
id
Returns the Id of the currently running task.
sleep
Waits until duration has elapsed.
spawn
Spawns a new asynchronous task, returning a JoinHandle for it.
spawn_blocking
Runs the provided closure on a thread where blocking is acceptable.
spawn_local
Spawns a !Send future on the current LocalSet or LocalRuntime.
try_id
Returns the Id of the currently running task, or None if called outside of a task.
unconstrained
Turn off cooperative scheduling for a future. The future will never be forced to yield by Tokio. Using this exposes your service to starvation if the unconstrained future never yields otherwise.
yield_now
Yields execution back to the Tokio runtime.