pub struct PerCpu<T, S> { /* private fields */ }Expand description
Typed descriptor for one symbol replicated in every runtime CPU area.
Implementations§
Source§impl<T, S> PerCpu<T, S>where
S: PerCpuSymbol<T>,
impl<T, S> PerCpu<T, S>where
S: PerCpuSymbol<T>,
Sourcepub fn current_ptr(&self, pin: &CpuPin<'_>) -> NonNull<T>
pub fn current_ptr(&self, pin: &CpuPin<'_>) -> NonNull<T>
Returns a typed pointer whose address is stable for pin.
Sourcepub fn remote_ptr(&self, area: PerCpuArea) -> NonNull<T>
pub fn remote_ptr(&self, area: PerCpuArea) -> NonNull<T>
Returns a typed pointer in an explicitly selected remote area.
The caller remains responsible for synchronization before dereference.
Source§impl<T, S> PerCpu<T, S>where
S: PerCpuObjectSymbol<T>,
impl<T, S> PerCpu<T, S>where
S: PerCpuObjectSymbol<T>,
Sourcepub fn with_current_mut<R>(
&self,
exclusive: &ExclusiveCpu<'_>,
operation: impl for<'value> FnOnce(&'value mut T) -> R,
) -> R
pub fn with_current_mut<R>( &self, exclusive: &ExclusiveCpu<'_>, operation: impl for<'value> FnOnce(&'value mut T) -> R, ) -> R
Mutates the current CPU’s object without allowing its borrow to escape.
Source§impl<T, S> PerCpu<T, S>where
T: Sync,
S: PerCpuObjectSymbol<T>,
impl<T, S> PerCpu<T, S>where
T: Sync,
S: PerCpuObjectSymbol<T>,
Sourcepub fn with_current<R>(
&self,
pin: &CpuPin<'_>,
operation: impl for<'value> FnOnce(&'value T) -> R,
) -> R
pub fn with_current<R>( &self, pin: &CpuPin<'_>, operation: impl for<'value> FnOnce(&'value T) -> R, ) -> R
Borrows a shared current-CPU object for one non-escaping callback.
Source§impl<T, S> PerCpu<T, S>where
T: Sealed,
S: PerCpuPrimitiveSymbol<T>,
impl<T, S> PerCpu<T, S>where
T: Sealed,
S: PerCpuPrimitiveSymbol<T>,
Sourcepub fn read_current(&self, pin: &CpuPin<'_>) -> T
pub fn read_current(&self, pin: &CpuPin<'_>) -> T
Loads the current CPU’s atomic scalar with relaxed ordering.
Sourcepub fn write_current(&self, pin: &CpuPin<'_>, value: T)
pub fn write_current(&self, pin: &CpuPin<'_>, value: T)
Stores the current CPU’s atomic scalar with relaxed ordering.
Auto Trait Implementations§
impl<T, S> Freeze for PerCpu<T, S>
impl<T, S> RefUnwindSafe for PerCpu<T, S>
impl<T, S> Send for PerCpu<T, S>
impl<T, S> Sync for PerCpu<T, S>
impl<T, S> Unpin for PerCpu<T, S>
impl<T, S> UnsafeUnpin for PerCpu<T, S>
impl<T, S> UnwindSafe for PerCpu<T, S>
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
Mutably borrows from an owned value. Read more