pub struct Srcu { /* private fields */ }Expand description
Sleepable read-copy update primitive.
SRCU readers may sleep while holding the read-side guard.
The destructor waits for active readers and callbacks, so it may sleep.
If a read-side guard has been leaked, dropping an Srcu may never return.
§Invariants
This represents a valid struct srcu_struct initialized by the C SRCU API
and it remains pinned and valid until the pinned destructor runs.
Implementations§
Source§impl Srcu
impl Srcu
Sourcepub fn new(
name: &'static CStr,
key: Pin<&'static LockClassKey>,
) -> impl PinInit<Self, Error>
pub fn new( name: &'static CStr, key: Pin<&'static LockClassKey>, ) -> impl PinInit<Self, Error>
Creates a new SRCU instance.
Sourcepub fn read_lock(&self) -> Guard<'_>
pub fn read_lock(&self) -> Guard<'_>
Enters an SRCU read-side critical section.
Leaking the returned Guard leaves the SRCU read-side critical
section active and makes drop sleep forever.
Sourcepub fn synchronize(&self)
pub fn synchronize(&self)
Waits until all pre-existing SRCU readers have completed.
Sourcepub fn synchronize_expedited(&self)
pub fn synchronize_expedited(&self)
Waits until all pre-existing SRCU readers have completed, expedited.
This requests a lower-latency grace period than Srcu::synchronize typically
at the cost of higher system-wide overhead. Prefer Srcu::synchronize by default
and use this variant only when reducing reset or teardown latency is more important
than the extra cost.
Trait Implementations§
Source§impl PinnedDrop for Srcu
impl PinnedDrop for Srcu
impl Send for Srcu
impl Sync for Srcu
Auto Trait Implementations§
impl !Freeze for Srcu
impl !RefUnwindSafe for Srcu
impl !UnsafeUnpin for Srcu
impl UnwindSafe for Srcu
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<S, T> IntoSafeCast<T> for Swhere
T: FromSafeCast<S>,
impl<S, T> IntoSafeCast<T> for Swhere
T: FromSafeCast<S>,
Source§fn into_safe_cast(self) -> T
fn into_safe_cast(self) -> T
self into a T. This operation is guaranteed to be lossless.Source§impl<S, T> IntoSafeCastArch<T> for Swhere
T: FromSafeCastArch<S>,
impl<S, T> IntoSafeCastArch<T> for Swhere
T: FromSafeCastArch<S>,
Source§fn into_safe_cast_arch(self) -> T
fn into_safe_cast_arch(self) -> T
self into a T. This operation is guaranteed to be lossless.