Crate flexible_locks

Source
Expand description

§Flexible Locks

This crate aims at providing generic, flexible implementations of locking primitives. For now, it only provides Mutex types (i.e. no RwLock, etc.), without poisoning, and without try_lock. Support for those can be added in the future if there is interest (patches welcome). Poisoning is not necessary with panic=abort.

The provided types allow flexibility in layout and locking implementation. See the Mutex, MutexWrap and RawOsMutex documentation for more details.

§Features

The parking_lot feature can be enabled, providing a RawMutex implementation for parking_log::Mutex<()>.

Macros§

mutex_new
Statically initializes a Mutex or a MutexWrap.
pthread_mutex_new
Statically initializes a pthread_mutex_t
raw_os_mutex_new
Statically initializes a RawOsMutex

Structs§

Mutex
A mutual exclusion primitive useful for protecting shared data
MutexGuard
An RAII implementation of a “scoped lock” of a mutex. When this structure is dropped (falls out of scope), the lock will be unlocked.
MutexWrap
A mutual exclusion primitive useful for protecting shared data
RawOsMutex
Platform mutex primitives for use with [Mutex] and [MutexWrap].

Traits§

MutexProtected
A trait describing types that can be wrapped in a Mutex.
RawMutex
A trait for raw mutual exclusion primitives.
UnsafeRawOsMutex
A trait for unsafe raw mutual exclusion primitives.

Type Aliases§

pthread_mutex_t
RawOsMutex wrapper for libc::pthread_mutex_t.