pub struct PerCPU<T>(UnsafeCell<[Align<T>; 1]>);
Expand description
Abstraction for per cpu data.
As the data can only edited by the corresponding cpu, mutable access is save even without locking. The data is cache aligned, to prevent false-sharing effects.
§Safety
Be aware of context switches! If the thread changes while the per-cpu data is updated, things might break. Disable interrupts or enter the E1/2 to prevent this!
Tuple Fields§
§0: UnsafeCell<[Align<T>; 1]>