Skip to main content

Crate parking_lot

Crate parking_lot 

Source
Expand description

This library provides compact and efficient implementations of Mutex, FairMutex, ReentrantMutex, RwLock, RecursiveRwLock, Condvar and Once.

§Use in global allocators

The synchronization primitives in this crate must not be used internally by a global allocator. Their contended paths may allocate memory, including while internal parking-lot locks are held. If the allocator then blocks on one of these primitives, it may recursively invoke itself or deadlock.

Re-exports§

pub use ::lock_api;

Modules§

deadlock
[Experimental] Deadlock detection

Structs§

ArcMutexGuard
An RAII mutex guard returned by the Arc locking operations on Mutex.
ArcReentrantMutexGuard
An RAII mutex guard returned by the Arc locking operations on ReentrantMutex.
ArcRwLockReadGuard
An RAII read guard returned by the Arc locking operations on RwLock.
ArcRwLockUpgradableReadGuard
An RAII upgradable read guard returned by the Arc locking operations on RwLock. Unlike RwLockUpgradableReadGuard, this guard owns the Arc used to unlock the reader-writer lock instead of borrowing it, so its lifetime is not tied to a lock reference.
ArcRwLockWriteGuard
An RAII write guard returned by the Arc locking operations on RwLock. Unlike RwLockWriteGuard, this guard owns the Arc used to unlock the reader-writer lock instead of borrowing it, so its lifetime is not tied to a lock reference.
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.
RawCondvar
A raw condition variable.
RawFairMutex
Raw fair mutex type backed by the parking lot.
RawMutex
Raw mutex type backed by the parking lot.
RawRwLock
Raw reader-writer lock type backed by the parking lot.
RawThreadId
Implementation of the GetThreadId trait for lock_api::ReentrantMutex.
WaitTimeoutResult
A type indicating whether a timed wait on a condition variable timed out.

Enums§

OnceState
Current state of a Once.

Type Aliases§

Condvar
A condition variable.
FairMutex
A mutual exclusion primitive that uses fair unlocking, useful for protecting shared data.
FairMutexGuard
An RAII guard which unlocks the mutex when dropped.
MappedFairMutexGuard
An RAII mutex guard returned by FairMutexGuard::map, which can point to a subfield of the protected data.
MappedMutexGuard
An RAII mutex guard returned by MutexGuard::map, which can point to a subfield of the protected data.
MappedRecursiveRwLockReadGuard
A mapped RAII guard which releases shared access when dropped.
MappedRecursiveRwLockWriteGuard
A mapped RAII guard which releases exclusive access when dropped.
MappedReentrantMutexGuard
An RAII mutex guard returned by ReentrantMutexGuard::map, which can point to a subfield of the protected data.
MappedRwLockReadGuard
An RAII read lock guard returned by RwLockReadGuard::map, which can point to a subfield of the protected data.
MappedRwLockWriteGuard
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.
MutexGuard
An RAII guard which unlocks the mutex when dropped.
RawRwLockRecursive
Raw reader-writer lock which permits recursive read locking.
RecursiveRwLock
A reader-writer lock which permits recursive read locking.
RecursiveRwLockReadGuard
An RAII guard which releases shared read access when dropped.
RecursiveRwLockUpgradableReadGuard
An RAII guard which releases upgradable read access when dropped.
RecursiveRwLockWriteGuard
An RAII guard which releases exclusive write access when dropped.
ReentrantMutex
A reentrant mutual exclusion lock.
ReentrantMutexGuard
An RAII guard which releases one level of recursive locking when dropped.
RwLock
A reader-writer lock.
RwLockReadGuard
An RAII guard which releases shared read access when dropped.
RwLockUpgradableReadGuard
An RAII guard which releases upgradable read access when dropped.
RwLockWriteGuard
An RAII guard which releases exclusive write access when dropped.