pub enum CrossProcessLockState {
Clean(CrossProcessLockGuard),
Dirty(CrossProcessLockGuard),
}Expand description
Represent a successful result of a locking attempt, either by
CrossProcessLock::try_lock_once or CrossProcessLock::spin_lock.
Variants§
Clean(CrossProcessLockGuard)
The lock has been obtained successfully, all good.
Dirty(CrossProcessLockGuard)
The lock has been obtained successfully, but the lock is dirty!
This holder has obtained this cross-process lock once, then another holder has obtained this cross-process lock before this holder obtained it again. The lock is marked as dirty. It means the value protected by the cross-process lock may need to be reloaded if synchronisation is important.
Until CrossProcessLock::clear_dirty is called,
CrossProcessLock::is_dirty, CrossProcessLock::try_lock_once and
CrossProcessLock::spin_lock will report the lock as dirty. Put it
differently: dirty once, dirty forever, unless
CrossProcessLock::clear_dirty is called.
Implementations§
Source§impl CrossProcessLockState
impl CrossProcessLockState
Sourcepub fn into_guard(self) -> CrossProcessLockGuard
pub fn into_guard(self) -> CrossProcessLockGuard
Map this value into the inner CrossProcessLockGuard.
Sourcepub fn map<F, G>(self, mapper: F) -> MappedCrossProcessLockState<G>where
F: FnOnce(CrossProcessLockGuard) -> G,
pub fn map<F, G>(self, mapper: F) -> MappedCrossProcessLockState<G>where
F: FnOnce(CrossProcessLockGuard) -> G,
Map this CrossProcessLockState into a
MappedCrossProcessLockState.
This is helpful when one wants to create its own wrapper over
CrossProcessLockGuard.