Expand description
This crate provides non thread-safe versions of the primitives in std::sync and std::lazy
suitable for use in single-threaded no_std environments.
§Features
-
Mutex,RwLock,Once/SyncOnceCell, andSyncLazyequivalents -
Support for
no_stdenvironments -
lock_apicompatibility -
Upgradeable
RwLockguards -
Guards can be sent and shared between threads
-
Guard leaking
§Relationship with std::sync
While spin is not a drop-in replacement for std::sync an effort has been
made to keep this crate reasonably consistent with std::sync.
§Feature flags
The crate comes with a few feature flags that you may wish to use.
lock_apienables support forlock_api
Re-exports§
pub use lazy::Lazy;lazypub use mutex::Mutex;mutexpub use mutex::MutexGuard;mutexpub use once::Once;oncepub use rwlock::RwLock;rwlockpub use rwlock::RwLockReadGuard;rwlockpub use rwlock::RwLockUpgradableGuard;rwlockpub use rwlock::RwLockWriteGuard;rwlock
Modules§
- lazy
lazy - Synchronization primitives for lazy evaluation.
- lock_
api lock_api - Spin synchronisation primitives, but compatible with
lock_api. - mutex
mutex - Locks that have the same behaviour as a mutex.
- once
once - Synchronization primitives for one-time evaluation.
- rwlock
rwlock - A lock that provides data access to either one writer or many readers.