Crate lilos_rwlock
source ·Expand description
A read-write lock for use with lilos
.
There’s a small family of related types in this here crate:
RwLock<T>
contains some data of typeT
and allows either multiple shared references, or one exclusive reference, but not both simultaneously.SharedGuard<T>
represents a shared reference to the data guarded by aRwLock
and allows access to it (viaDeref
).ActionPermit<T>
represents an exclusive reference to the data guarded by aRwLock
, but once you start doing something that can modify the data, you can’tawait
, to ensure that cancellation won’t corrupt the guarded data.ExclusiveGuard<T>
allows arbitrary exclusive access, even acrossawait
points, but you have to promise the library that the data is inherently cancel-safe (by using thelilos::util::CancelSafe
marker type).
See the docs on RwLock
for more details.
Macros§
- Convenience macro for creating an
RwLock
.
Structs§
- Permit returned by
RwLock::lock_exclusive
orRwLock::try_lock_exclusive
that indicates that the holder has exclusive access to the lock, and that permits non-async
alterations to the guarded data. - A resource object that grants read/write access to the data guarded by an
RwLock
. - Error produced by
RwLock::try_lock_shared
and related non-blocking locking operations. - A lock that guards data of type
T
and allows, at any one time, shared access by many readers, or exclusive access by one writer, but not both. - Resource object that grants shared access to guarded data of type
T
.