1#![cfg_attr(docsrs, feature(doc_cfg))]
2#![warn(
3 clippy::ptr_as_ptr,
4 missing_docs,
5 unsafe_op_in_unsafe_fn,
6 unused_qualifications
7)]
8#![no_std]
9
10extern crate alloc;
13#[cfg(feature = "std")]
14extern crate std;
15
16pub mod atomic;
17mod mutex;
18mod rwlock;
19
20pub use mutex::RawMutex;
21pub use rwlock::RawRwLock;
22
23cfg_if::cfg_if! {
24 if #[cfg(target_has_atomic = "ptr")] {
25 pub use alloc::sync::{Arc, Weak};
26 } else if #[cfg(feature = "portable-atomic")] {
27 pub use portable_atomic_util::{Arc, Weak};
28 }
29}
30
31#[cfg(feature = "std")]
35pub use parking_lot::{Condvar, Mutex as CondvarMutex};
36
37pub use once_cell::race::{OnceBool, OnceBox, OnceNonZeroUsize, OnceRef};
38
39cfg_if::cfg_if! {
40 if #[cfg(feature = "std")] {
41 pub use once_cell::sync::{Lazy, OnceCell};
42 } else {
43 pub use once_cell::unsync::{Lazy, OnceCell};
44 }
45}
46
47pub type Mutex<T> = lock_api::Mutex<RawMutex, T>;
49
50pub type MutexGuard<'a, T> = lock_api::MutexGuard<'a, RawMutex, T>;
52
53pub type MappedMutexGuard<'a, T> = lock_api::MappedMutexGuard<'a, RawMutex, T>;
55
56pub type RwLock<T> = lock_api::RwLock<RawRwLock, T>;
58
59pub type RwLockReadGuard<'a, T> = lock_api::RwLockReadGuard<'a, RawRwLock, T>;
61
62pub type RwLockWriteGuard<'a, T> = lock_api::RwLockWriteGuard<'a, RawRwLock, T>;
64
65pub type RwLockUpgradableReadGuard<'a, T> = lock_api::RwLockUpgradableReadGuard<'a, RawRwLock, T>;