Struct sc_consensus::shared_data::SharedDataLocked
source · pub struct SharedDataLocked<'a, T> { /* private fields */ }
Expand description
Created by SharedData::shared_data_locked
.
As long as this object isn’t dropped, the shared data is held in a mutex guard and the shared
data is tagged as locked. Access to the shared data is provided through
Deref
and DerefMut
. The trick is to use
Self::release_mutex
to release the mutex, but still keep the shared data locked. This means
every other thread trying to access the shared data in this time will need to wait until this
lock is freed.
If this object is dropped without calling Self::release_mutex
, the lock will be dropped
immediately.
Implementations§
sourcepub fn release_mutex(self) -> SharedDataLockedUpgradable<T>
pub fn release_mutex(self) -> SharedDataLockedUpgradable<T>
Release the mutex, but keep the shared data locked.
Trait Implementations§
Auto Trait Implementations§
Blanket Implementations§
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
fn saturated_from<T>(t: T) -> Selfwhere Self: UniqueSaturatedFrom<T>,
source§fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
fn saturated_into<T>(self) -> Twhere Self: UniqueSaturatedInto<T>,
Consume self to return an equivalent value of
T
. Read moresource§fn unchecked_into(self) -> T
fn unchecked_into(self) -> T
The counterpart to
unchecked_from
.source§fn unique_saturated_into(self) -> T
fn unique_saturated_into(self) -> T
Consume self to return an equivalent value of
T
.