Trait RcuReadContext

Source
pub unsafe trait RcuReadContext: RcuContext {
    type Guard<'a>: RcuGuard<Flavor = Self::Flavor> + 'a
       where Self: 'a;

    // Required methods
    fn rcu_read_lock(&self) -> Self::Guard<'_>;
    fn rcu_call<F>(&self, callback: Box<F>)
       where F: RcuCall + Send + 'static;
}
Expand description

This trait defines the per-thread RCU read context.

§Safety

For callbacks (rcu_call), a barrier (rcu_barrier) should be executed before cleaning up the context. Failure to do so might results in memory leaks and object cleanups that don’t happen.

Required Associated Types§

Source

type Guard<'a>: RcuGuard<Flavor = Self::Flavor> + 'a where Self: 'a

Defines a guard for a RCU critical section.

Required Methods§

Source

fn rcu_read_lock(&self) -> Self::Guard<'_>

Starts a RCU critical section.

§Note

RCU critical sections may be nested.

Source

fn rcu_call<F>(&self, callback: Box<F>)
where F: RcuCall + Send + 'static,

Configures a callback to be called after the next RCU grace period is finished.

§Note

The function will internally call RcuReadContext::rcu_read_lock.

The callback must be Send because it will be executed by an helper thread.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<const DEFER: bool> RcuReadContext for RcuContextBp<true, DEFER>

§Safety

call_rcu barrier is called before cleanups.

Source§

type Guard<'a> = RcuGuardBp<'a>

Source§

impl<const DEFER: bool> RcuReadContext for RcuContextMb<true, DEFER>

§Safety

call_rcu barrier is called before cleanups.

Source§

type Guard<'a> = RcuGuardMb<'a>

Source§

impl<const DEFER: bool> RcuReadContext for RcuContextMemb<true, DEFER>

§Safety

call_rcu barrier is called before cleanups.

Source§

impl<const DEFER: bool> RcuReadContext for RcuContextQsbr<true, DEFER>

§Safety

call_rcu barrier is called before cleanups.