pub struct OwnedGuard<'a> { /* private fields */ }Expand description
A guard that protects objects for it’s lifetime, independent of the current thread.
Unlike LocalGuard, an owned guard is independent of the current thread,
allowing it to implement Send and Sync. This is useful for holding
guards across .await points in work-stealing schedulers, where execution
may be resumed on a different thread than started on. However, owned guards
are more expensive to create and destroy, so should be avoided if
cross-thread usage is not required.
Most of the functionality provided by this type is through the Guard
trait.
Trait Implementations§
Source§impl Drop for OwnedGuard<'_>
impl Drop for OwnedGuard<'_>
Source§impl Guard for OwnedGuard<'_>
impl Guard for OwnedGuard<'_>
Source§unsafe fn defer_retire<T>(
&self,
ptr: *mut T,
reclaim: unsafe fn(_: *mut T, _: &Collector),
)
unsafe fn defer_retire<T>( &self, ptr: *mut T, reclaim: unsafe fn(_: *mut T, _: &Collector), )
Retires a value, running reclaim when no threads hold a reference to
it.
Source§fn protect<T>(&self, ptr: &AtomicPtr<T>, order: Ordering) -> *mut T
fn protect<T>(&self, ptr: &AtomicPtr<T>, order: Ordering) -> *mut T
Protects the load of an atomic pointer. Read more
Source§fn swap<T>(&self, ptr: &AtomicPtr<T>, value: *mut T, order: Ordering) -> *mut T
fn swap<T>(&self, ptr: &AtomicPtr<T>, value: *mut T, order: Ordering) -> *mut T
Stores a value into the pointer, returning the protected previous value. Read more
impl Send for OwnedGuard<'_>
impl Sync for OwnedGuard<'_>
Auto Trait Implementations§
impl<'a> Freeze for OwnedGuard<'a>
impl<'a> !RefUnwindSafe for OwnedGuard<'a>
impl<'a> Unpin for OwnedGuard<'a>
impl<'a> !UnwindSafe for OwnedGuard<'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