pub struct RcuDomain { /* private fields */ }
Expand description
An RCU synchronization domain.
Implementations§
Source§impl RcuDomain
impl RcuDomain
Sourcepub fn run<F, R>(self, f: F) -> Rwhere
F: FnOnce() -> R,
pub fn run<F, R>(self, f: F) -> Rwhere
F: FnOnce() -> R,
Runs f
in a critical section. Calls to
synchronize
or
synchronize_blocking
for the same RCU root will
block until f
returns.
In general, you should avoid blocking the thread in f
, since that can
slow calls to synchronize
and can potentially
cause deadlocks.
Sourcepub fn quiesce(self)
pub fn quiesce(self)
Quiesce the current thread.
This can speed up calls to synchronize
or
synchronize_blocking
by allowing the RCU domain
to skip issuing a membarrier if all threads are quiesced. In return, the
first call to run
after this will be slower, as it will
need to issue a memory barrier to leave the quiesced state.
Sourcepub async fn quiesce_on_pending<Fut>(self, fut: Fut) -> Fut::Outputwhere
Fut: Future,
pub async fn quiesce_on_pending<Fut>(self, fut: Fut) -> Fut::Outputwhere
Fut: Future,
Runs fut
, calling quiesce
on the current thread
each time fut
returns Poll::Pending
.
Sourcepub async fn synchronize(self, sleep: impl AsyncFnMut(Duration))
pub async fn synchronize(self, sleep: impl AsyncFnMut(Duration))
Synchronizes the RCU domain, blocking asynchronously until all threads have exited their critical sections and observed the new sequence number.
sleep
should be a function that sleeps for the specified duration.
Sourcepub fn synchronize_blocking(self)
pub fn synchronize_blocking(self)
Like synchronize
, but blocks the current thread
synchronously.