Expand description
Granular locking crate for Rust. Instead of using coarse-grained Mutex or RwLock which can be
used to lock an entire structure, glock provides more granular locking.
Code is hosted on github.com:
git clone https://github.com/aymanmadkour/glock
Structs§
- GLock
- Represents a granular lock object. A
GLockis used to protect a data value of typeT, which can only be accessed with a mutable reference after callinglock_exclusive(),try_lock_exclusive(),lock_exclusive_using_parent()ortry_lock_exclusive_using_parent(). - GLock
Builder - A
GLockBuildercan be used to construct nestedGLocks. In Rust, innerstructs are initialized before their outer containerstructs. Inglock, parent lock kernels must be initialized before child lock kernels. To resolve this, aGLockBuildercan be used to initialize the parent lock kernel first, then accept the containingstructinbuild(). - GLock
Guard - A
GLockGuardrepresents an acquired lock instance of any type. It can be used to access the protected data. The lock is released by dropping theGLockGuardobject. - GLock
Guard Mut - A
GLockGuardrepresents an acquiredExclusivelock instance. It can be used to read as well as mutate the protected data. The lock is released by dropping theGLockGuardMutobject.
Enums§
Type Aliases§
- Lock
Result - A type alias for
Result<T, LockError>.