1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
//! Synchronization primitives.

#[allow(dead_code)]

pub(crate) mod critical_mutex;
pub(crate) mod critical_section;
pub mod mutex;
pub mod semaphore;

pub mod channel;
pub mod spsc;
pub mod mpsc;

pub mod ipc;

pub use mutex::{Mutex, MutexGuard};
pub use semaphore::{Semaphore, SemaphorePermit};

/// Common error type for all sync primitives
#[derive(Debug)]
pub enum Error {
    /// Would block task
    WouldBlock,
    /// Request timed out
    TimeOut,
    /// Task holding the sync primitive panicked
    Poisoned,
    /// Cannot allocate primitive
    OutOfMemory,
}