Skip to main content

PerCpuVariants

Trait PerCpuVariants 

Source
pub trait PerCpuVariants<T: Clone + Sync + Send>:
    Sync
    + Send
    + Debug {
    // Required methods
    fn get(&self) -> &T;
    fn get_mut(&self) -> &mut T;
    unsafe fn force_get(&self, cpu: u32) -> &T;
    unsafe fn force_get_mut(&self, cpu: u32) -> &mut T;
}
Expand description

PerCpuVariants is a trait for per-cpu data structures.

Required Methods§

Source

fn get(&self) -> &T

Get the per-cpu data for the current CPU.

Source

fn get_mut(&self) -> &mut T

Get the per-cpu data for the current CPU.

Source

unsafe fn force_get(&self, cpu: u32) -> &T

Get the per-cpu data for the given CPU.

§Safety

This function is unsafe because it allows access to the per-cpu data for a CPU that may not be the current CPU. The caller must ensure that the CPU is valid and that the data is not accessed from a different CPU.

Source

unsafe fn force_get_mut(&self, cpu: u32) -> &mut T

Get the per-cpu data for the given CPU.

§Safety

This function is unsafe because it allows access to the per-cpu data for a CPU that may not be the current CPU. The caller must ensure that the CPU is valid and that the data is not accessed from a different CPU.

Implementors§