[−][src]Struct crossbeam::mem::CachePadded
Pad T to the length of a cacheline.
Sometimes concurrent programming requires a piece of data to be padded out
to the size of a cacheline to avoid "false sharing": cachelines being
invalidated due to unrelated concurrent activity. Use the CachePadded type
when you want to avoid cache locality.
At the moment, cache lines are assumed to be 32 * sizeof(usize) on all architectures.
Warning: the wrapped data is never dropped; move out using ptr::read
if you need to run dtors.
Methods
impl<T: ZerosValid> CachePadded<T>[src]
pub fn zeroed() -> CachePadded<T>[src]
A const fn equivalent to mem::zeroed().
impl<T> CachePadded<T>[src]
pub fn new(t: T) -> CachePadded<T>[src]
Wrap t with cacheline padding.
Warning: the wrapped data is never dropped; move out using
ptr:read if you need to run dtors.
Trait Implementations
impl<T: Sync> Sync for CachePadded<T>[src]
impl<T: Send> Send for CachePadded<T>[src]
impl<T> DerefMut for CachePadded<T>[src]
impl<T> Debug for CachePadded<T>[src]
impl<T> Deref for CachePadded<T>[src]
Blanket Implementations
impl<T> From for T[src]
impl<T, U> Into for T where
U: From<T>, [src]
U: From<T>,
impl<T, U> TryFrom for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T> Borrow for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T, U> TryInto for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,