broker_tokio/sync/
mod.rs

1#![cfg_attr(loom, allow(dead_code, unreachable_pub, unused_imports))]
2
3//! Future-aware synchronization
4//!
5//! This module is enabled with the **`sync`** feature flag.
6//!
7//! Tasks sometimes need to communicate with each other. This module contains
8//! basic abstractions for doing so:
9//!
10//! - [oneshot](oneshot/index.html), a way of sending a single value
11//!   from one task to another.
12//! - [mpsc](mpsc/index.html), a multi-producer, single-consumer channel for
13//!   sending values between tasks.
14//! - [`Mutex`](struct.Mutex.html), an asynchronous `Mutex`-like type.
15//! - [watch](watch/index.html), a single-producer, multi-consumer channel that
16//!   only stores the **most recently** sent value.
17
18cfg_sync! {
19    mod barrier;
20    pub use barrier::{Barrier, BarrierWaitResult};
21
22    pub mod broadcast;
23
24    pub mod mpsc;
25
26    mod mutex;
27    pub use mutex::{Mutex, MutexGuard};
28
29    pub mod oneshot;
30
31    pub(crate) mod semaphore_ll;
32    mod semaphore;
33    pub use semaphore::{Semaphore, SemaphorePermit};
34
35    mod rwlock;
36    pub use rwlock::{RwLock, RwLockReadGuard, RwLockWriteGuard};
37
38    mod task;
39    pub(crate) use task::AtomicWaker;
40
41    pub mod watch;
42}
43
44cfg_not_sync! {
45    cfg_atomic_waker_impl! {
46        mod task;
47        pub(crate) use task::AtomicWaker;
48    }
49
50    #[cfg(any(
51            feature = "rt-core",
52            feature = "process",
53            feature = "signal"))]
54    pub(crate) mod oneshot;
55
56    cfg_signal! {
57        pub(crate) mod mpsc;
58        pub(crate) mod semaphore_ll;
59    }
60}
61
62/// Unit tests
63#[cfg(test)]
64mod tests;