Struct nolock::hazard_ptr::Guard
source · [−]pub struct Guard<T> { /* private fields */ }
Expand description
A Guard protects a single Memory address and provides secure access to it, as long as the Guard is not dropped
Implementations
sourceimpl<T> Guard<T>
impl<T> Guard<T>
sourcepub fn protect(&mut self, atom_ptr: &AtomicPtr<T>, load_order: Ordering)
pub fn protect(&mut self, atom_ptr: &AtomicPtr<T>, load_order: Ordering)
Loads the most recent Ptr-Value from the given AtomicPtr and updates the current Guard to now protect this new Ptr.
Usage
This should be used when you already have Guard, but no longer need the original Guard/Value and now need to protect another new Memory- Location, as this method reuses an already owned Hazard-Pointer/Guard and therefore does not need to acquire a Hazard-Pointer beforehand.
This is especially useful when iterating a Datastruture, as you often only have one Node you are currently processing and then move on to another one.
Trait Implementations
Auto Trait Implementations
impl<T> RefUnwindSafe for Guard<T>where
T: RefUnwindSafe,
impl<T> !Send for Guard<T>
impl<T> !Sync for Guard<T>
impl<T> Unpin for Guard<T>
impl<T> UnwindSafe for Guard<T>where
T: RefUnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more