Module tokio::sync

source · []
Expand description

Future-aware synchronization

This module is enabled with the sync feature flag.

Tasks sometimes need to communicate with each other. This module contains two basic abstractions for doing so:

  • oneshot, a way of sending a single value from one task to another.
  • mpsc, a multi-producer, single-consumer channel for sending values between tasks.
  • lock, an asynchronous Mutex-like type.
  • watch, a single-producer, multi-consumer channel that only stores the most recently sent value.

Modules

An asynchronous Mutex-like type.

A multi-producer, single-consumer queue for sending values across asynchronous tasks.

A channel for sending a single message between asynchronous tasks.

A single-producer, multi-consumer channel that only retains the last sent value.