Crate mbarrier

Crate mbarrier 

Source
Expand description

§mbarrier - Cross-platform Memory Barriers for Rust

This crate provides memory barrier implementations inspired by the Linux kernel, offering cross-platform support for various CPU architectures.

Memory barriers are synchronization primitives that prevent certain types of memory reordering performed by CPUs and compilers.

§Example

use mbarrier::*;

// Read memory barrier
rmb();

// Write memory barrier
wmb();

// General memory barrier
mb();

// SMP-aware barriers
smp_rmb();
smp_wmb();
smp_mb();

Functions§

mb
General memory barrier.
mb_impl
x86/x86_64 general memory barrier implementation.
rmb
Read memory barrier.
rmb_impl
x86/x86_64 read memory barrier implementation.
smp_mb
SMP general memory barrier.
smp_rmb
SMP read memory barrier.
smp_wmb
SMP write memory barrier.
wmb
Write memory barrier.
wmb_impl
x86/x86_64 write memory barrier implementation.