2019-11-21 23:28:39 -08:00
|
|
|
#![cfg_attr(loom, allow(dead_code, unreachable_pub, unused_imports))]
|
|
|
|
|
|
2019-01-22 11:37:26 -08:00
|
|
|
//! 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](oneshot/index.html), a way of sending a single value
|
|
|
|
|
//! from one task to another.
|
|
|
|
|
//! - [mpsc](mpsc/index.html), a multi-producer, single-consumer channel for
|
|
|
|
|
//! sending values between tasks.
|
2019-09-19 11:46:52 -04:00
|
|
|
//! - [`Mutex`](struct.Mutex.html), an asynchronous `Mutex`-like type.
|
2019-02-22 21:54:50 -08:00
|
|
|
//! - [watch](watch/index.html), a single-producer, multi-consumer channel that
|
|
|
|
|
//! only stores the **most recently** sent value.
|
2019-01-22 11:37:26 -08:00
|
|
|
|
2019-11-18 07:00:55 -08:00
|
|
|
cfg_sync! {
|
|
|
|
|
mod barrier;
|
|
|
|
|
pub use barrier::{Barrier, BarrierWaitResult};
|
2019-10-29 15:11:31 -07:00
|
|
|
|
2019-11-18 07:00:55 -08:00
|
|
|
pub mod mpsc;
|
2019-10-29 15:11:31 -07:00
|
|
|
|
2019-11-18 07:00:55 -08:00
|
|
|
mod mutex;
|
|
|
|
|
pub use mutex::{Mutex, MutexGuard};
|
2019-10-29 15:11:31 -07:00
|
|
|
|
2019-11-18 07:00:55 -08:00
|
|
|
pub mod oneshot;
|
2019-10-29 15:11:31 -07:00
|
|
|
|
2019-11-18 07:00:55 -08:00
|
|
|
pub(crate) mod semaphore;
|
2019-10-29 15:11:31 -07:00
|
|
|
|
2019-11-18 07:00:55 -08:00
|
|
|
mod task;
|
|
|
|
|
pub(crate) use task::AtomicWaker;
|
2019-10-29 15:11:31 -07:00
|
|
|
|
2019-11-18 07:00:55 -08:00
|
|
|
pub mod watch;
|
|
|
|
|
}
|
2019-10-29 15:11:31 -07:00
|
|
|
|
2019-11-18 07:00:55 -08:00
|
|
|
cfg_not_sync! {
|
2019-11-21 23:28:39 -08:00
|
|
|
cfg_resource_drivers! {
|
2019-11-18 07:00:55 -08:00
|
|
|
mod task;
|
|
|
|
|
pub(crate) use task::AtomicWaker;
|
|
|
|
|
}
|
2019-10-29 15:11:31 -07:00
|
|
|
|
2019-11-22 15:55:10 -08:00
|
|
|
#[cfg(any(
|
|
|
|
|
feature = "rt-core",
|
|
|
|
|
feature = "process",
|
|
|
|
|
feature = "signal"))]
|
|
|
|
|
pub(crate) mod oneshot;
|
2019-11-18 07:00:55 -08:00
|
|
|
|
|
|
|
|
cfg_signal! {
|
|
|
|
|
pub(crate) mod mpsc;
|
|
|
|
|
pub(crate) mod semaphore;
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-10-29 15:11:31 -07:00
|
|
|
|
|
|
|
|
/// Unit tests
|
|
|
|
|
#[cfg(test)]
|
|
|
|
|
mod tests;
|