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.