[][src]Struct run_down::RundownRef

pub struct RundownRef { /* fields omitted */ }

Tracks the status of run-down protection for an object. The type would be embedded in the object needing run-down protection.

Methods

impl RundownRef[src]

pub fn new() -> Self[src]

Initializes a new RundownRef.

pub fn re_init(&self)[src]

Re-initialize this instance so it can be used again. It is only valid to call re_init once the object is completely run-down, via the wait_for_rundown method.

Important

The moment this method returns, new rundown protection requests can succeed. You must perform all re-initialization of the shared object the run-down protection is guarding before you call this method.

pub fn try_acquire(&self) -> Result<RundownGuard, RundownError>[src]

Attempts to acquire rundown protection on this RundownRef, returns the RundownGuard which holds the reference count, or returns an error if the object is already being rundown.

pub fn release(&self)[src]

Release previously acquired rundown protection.

pub fn wait_for_rundown(&self)[src]

Blocks thread execution until there are no outstanding reference counts taken on the RundownRef, and the internal representation has been marked with [RundownFlags::RUNDOWN_IN_PROGRESS] to signal that no other thread can safely acquire a reference count afterwards.

Important

  • This method is not thread safe, it must only be called by one thread.

  • This method is however idempotent, it can be called multiple times.

Trait Implementations

impl Default for RundownRef[src]

Auto Trait Implementations

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = !

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]