#[cpu_local]
Expand description
A macro for declaring CPU-local variables.
Variables must be an unsigned integer, bar u128
.
The initialisation expression has no effect; to set the initial value,
per_cpu::PerCpuData::new
must be modified.
Arguments
The macro supports additional named arguments defined after the offset (e.g.
#[cpu_local(0, cls_dep = false)]
):
cls_dep
: Whether to define methods that depend oncls
indirectly adding a dependency onpreemption
andirq_safety
. This is only really useful for CPU locals defined inpreemption
to avoid a circular dependency. Defaults to true.stores_guard
: If defined, must be set to eitherHeldInterrupts
orPreemptionGuard
and signifies that the CPU local has the typeOption<Guard>
. This option defines special methods that use the guard being switched into the CPU local, rather than an additional guard parameter, as proof that the CPU local can be safely accessed.