Struct solana_runtime::in_mem_accounts_index::FlushGuard
source · struct FlushGuard<'a> {
flushing: &'a AtomicBool,
}
Expand description
An RAII implementation of a scoped lock for the flushing_active
atomic flag in
InMemAccountsIndex
. When this structure is dropped (falls out of scope), the flag will be
cleared (set to false).
After successfully locking (calling FlushGuard::lock()
), pass a reference to the FlashGuard
instance to any function/code that requires the flushing_active
flag has been set (to true).
Fields§
§flushing: &'a AtomicBool
Implementations§
source§impl<'a> FlushGuard<'a>
impl<'a> FlushGuard<'a>
sourcefn lock(flushing: &'a AtomicBool) -> Option<Self>
fn lock(flushing: &'a AtomicBool) -> Option<Self>
Set the flushing
atomic flag to true. If the flag was already true, then return None
(so as to not clear the flag erroneously). Otherwise return Some(FlushGuard)
.
Trait Implementations§
source§impl<'a> Debug for FlushGuard<'a>
impl<'a> Debug for FlushGuard<'a>
Auto Trait Implementations§
impl<'a> RefUnwindSafe for FlushGuard<'a>
impl<'a> Send for FlushGuard<'a>
impl<'a> Sync for FlushGuard<'a>
impl<'a> Unpin for FlushGuard<'a>
impl<'a> UnwindSafe for FlushGuard<'a>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more