Expand description
This library provides implementations of Mutex
, RwLock
, Condvar
and
Once
that are smaller, faster and more flexible than those in the Rust
standard library. It also provides a ReentrantMutex
type.
Re-exportsยง
pub use ::lock_api;
Modulesยง
- condvar ๐
- deadlock ๐
- [Experimental] Deadlock detection
- elision ๐
- fair_
mutex ๐ - mutex ๐
- once ๐
- raw_
fair_ ๐mutex - raw_
mutex ๐ - raw_
rwlock ๐ - remutex ๐
- rwlock ๐
- util ๐
Structsยง
- Condvar
- A Condition Variable
- Once
- A synchronization primitive which can be used to run a one-time initialization. Useful for one-time initialization for globals, FFI or related functionality.
- RawFair
Mutex - Raw fair mutex type backed by the parking lot.
- RawMutex
- Raw mutex type backed by the parking lot.
- RawRw
Lock - Raw reader-writer lock type backed by the parking lot.
- RawThread
Id - Implementation of the
GetThreadId
trait forlock_api::ReentrantMutex
. - Wait
Timeout Result - A type indicating whether a timed wait on a condition variable returned due to a time out or not.
Enumsยง
- Once
State - Current state of a
Once
.
Functionsยง
- const_
fair_ mutex - Creates a new fair mutex in an unlocked state ready for use.
- const_
mutex - Creates a new mutex in an unlocked state ready for use.
- const_
reentrant_ mutex - Creates a new reentrant mutex in an unlocked state ready for use.
- const_
rwlock - Creates a new instance of an
RwLock<T>
which is unlocked.
Type Aliasesยง
- Fair
Mutex - A mutual exclusive primitive that is always fair, useful for protecting shared data
- Fair
Mutex Guard - An RAII implementation of a โscoped lockโ of a mutex. When this structure is dropped (falls out of scope), the lock will be unlocked.
- Guard
Marker ๐ - Mapped
Fair Mutex Guard - An RAII mutex guard returned by
FairMutexGuard::map
, which can point to a subfield of the protected data. - Mapped
Mutex Guard - An RAII mutex guard returned by
MutexGuard::map
, which can point to a subfield of the protected data. - Mapped
Reentrant Mutex Guard - An RAII mutex guard returned by
ReentrantMutexGuard::map
, which can point to a subfield of the protected data. - Mapped
RwLock Read Guard - An RAII read lock guard returned by
RwLockReadGuard::map
, which can point to a subfield of the protected data. - Mapped
RwLock Write Guard - An RAII write lock guard returned by
RwLockWriteGuard::map
, which can point to a subfield of the protected data. - Mutex
- A mutual exclusion primitive useful for protecting shared data
- Mutex
Guard - An RAII implementation of a โscoped lockโ of a mutex. When this structure is dropped (falls out of scope), the lock will be unlocked.
- Reentrant
Mutex - A mutex which can be recursively locked by a single thread.
- Reentrant
Mutex Guard - An RAII implementation of a โscoped lockโ of a reentrant mutex. When this structure is dropped (falls out of scope), the lock will be unlocked.
- RwLock
- A reader-writer lock
- RwLock
Read Guard - RAII structure used to release the shared read access of a lock when dropped.
- RwLock
Upgradable Read Guard - RAII structure used to release the upgradable read access of a lock when dropped.
- RwLock
Write Guard - RAII structure used to release the exclusive write access of a lock when dropped.