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 typeTand allows either multiple shared references, or one exclusive reference, but not both simultaneously.SharedGuard<T>represents a shared reference to the data guarded by aRwLockand 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 acrossawaitpoints, but you have to promise the library that the data is inherently cancel-safe (by using thelilos::util::CancelSafemarker type).
See the docs on RwLock for more details.
Macros§
- create_
rwlock - Convenience macro for creating an
RwLock.
Structs§
- Action
Permit - Permit returned by
RwLock::lock_exclusiveorRwLock::try_lock_exclusivethat indicates that the holder has exclusive access to the lock, and that permits non-asyncalterations to the guarded data. - Exclusive
Guard - A resource object that grants read/write access to the data guarded by an
RwLock. - InUse
- Error produced by
RwLock::try_lock_sharedand related non-blocking locking operations. - RwLock
- A lock that guards data of type
Tand allows, at any one time, shared access by many readers, or exclusive access by one writer, but not both. - Shared
Guard - Resource object that grants shared access to guarded data of type
T.