pub unsafe trait RcuContext {
type Flavor: RcuFlavor;
type Poller<'a>: RcuPoller + 'a
where Self: 'a;
// Required methods
fn rcu_synchronize(&mut self);
fn rcu_synchronize_poller(&self) -> Self::Poller<'_>;
}Expand description
This trait defines the per-thread RCU context.
§Design
This trait exploits the borrowing rule of Rust.
At any given time, you can have either one mutable reference (
&mut T) or any number of immutable references (&T).
By exploiting this rule, we can enforce that a thread never executes a RCU
synchronization barrier at the same time as it holds a RCU read lock. For
example, RcuReadContext::rcu_read_lock requires (&self), meaning we can
nest as many read locks as we want. On the other hand, RcuContext::rcu_synchronize
requires &mut self, meaning we can never call it while a read guard borrows
&self.
§Safety
You must enforce single context per thread for a specific RCU flavor. Failure to do so can lead to a deadlock if a thread acquires a RCU read lock from one context and tries to do a RCU syncronization from another context.
Required Associated Types§
Required Methods§
Sourcefn rcu_synchronize(&mut self)
fn rcu_synchronize(&mut self)
Sourcefn rcu_synchronize_poller(&self) -> Self::Poller<'_>
fn rcu_synchronize_poller(&self) -> Self::Poller<'_>
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 READ: bool, const DEFER: bool> RcuContext for RcuContextBp<READ, DEFER>
§Safety
There can only be 1 instance per thread.
impl<const READ: bool, const DEFER: bool> RcuContext for RcuContextBp<READ, DEFER>
§Safety
There can only be 1 instance per thread.
type Flavor = RcuFlavorBp
type Poller<'a> = RcuPollerBp<'a>
Source§impl<const READ: bool, const DEFER: bool> RcuContext for RcuContextMb<READ, DEFER>
§Safety
There can only be 1 instance per thread.
impl<const READ: bool, const DEFER: bool> RcuContext for RcuContextMb<READ, DEFER>
§Safety
There can only be 1 instance per thread.
type Flavor = RcuFlavorMb
type Poller<'a> = RcuPollerMb<'a>
Source§impl<const READ: bool, const DEFER: bool> RcuContext for RcuContextMemb<READ, DEFER>
§Safety
There can only be 1 instance per thread.
impl<const READ: bool, const DEFER: bool> RcuContext for RcuContextMemb<READ, DEFER>
§Safety
There can only be 1 instance per thread.
type Flavor = RcuFlavorMemb
type Poller<'a> = RcuPollerMemb<'a>
Source§impl<const READ: bool, const DEFER: bool> RcuContext for RcuContextQsbr<READ, DEFER>
§Safety
There can only be 1 instance per thread.
impl<const READ: bool, const DEFER: bool> RcuContext for RcuContextQsbr<READ, DEFER>
§Safety
There can only be 1 instance per thread.