use core::fmt;
mod mutex;
pub use mutex::{MappedMutexGuard, Mutex, MutexGuard};
mod reentrant_lock;
pub use reentrant_lock::{ReentrantLock, ReentrantLockGuard};
mod rwlock;
pub use rwlock::{
MappedRwLockReadGuard, MappedRwLockWriteGuard, RwLock, RwLockReadGuard, RwLockWriteGuard,
};
pub use super::poison::Once;
mod once_lock;
pub use once_lock::OnceLock;
mod condvar;
pub use condvar::Condvar;
mod lazy_lock;
pub use lazy_lock::LazyLock;
mod barrier;
pub use barrier::{Barrier, BarrierWaitResult};
pub enum TryLockError {
WouldBlock,
}
pub type TryLockResult<Guard> = Result<Guard, TryLockError>;
impl fmt::Debug for TryLockError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match *self {
TryLockError::WouldBlock => "WouldBlock".fmt(f),
}
}
}
impl fmt::Display for TryLockError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match *self {
TryLockError::WouldBlock => "try_lock failed because the operation would block",
}
.fmt(f)
}
}
impl core::error::Error for TryLockError {}