[][src]Module tokio::sync

This is supported on feature="sync" only.

Future-aware synchronization

This module is enabled with the sync feature flag.

Tasks sometimes need to communicate with each other. This module contains 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.
  • Mutex, an asynchronous Mutex-like type.
  • watch, a single-producer, multi-consumer channel that only stores the most recently sent value.

Modules

broadcastfeature="sync"

A multi-producer, multi-consumer broadcast queue. Each sent value is seen by all consumers.

mpscfeature="sync"

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

oneshotfeature="sync"

A channel for sending a single message between asynchronous tasks.

watchfeature="sync"

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

Structs

Barrierfeature="sync"

A barrier enables multiple threads to synchronize the beginning of some computation.

BarrierWaitResultfeature="sync"

A BarrierWaitResult is returned by wait when all threads in the Barrier have rendezvoused.

Mutexfeature="sync"

An asynchronous mutual exclusion primitive useful for protecting shared data

MutexGuardfeature="sync"

A handle to a held Mutex.

Semaphorefeature="sync"

Counting semaphore performing asynchronous permit aquisition.

SemaphorePermitfeature="sync"

A permit from the semaphore