Skip to main content

## __dmb

# Function __dmb

Source

    pub unsafe fn __dmb<A>(arg: A)where
        A: Dmb,

🔬This is a nightly-only experimental API. (`stdarch_arm_barrier` #117219)
Available on (AArch64 or ARM or ARM64EC) and (AArch64 or ARM64EC) only.
Expand description

Generates a DMB (data memory barrier) instruction or equivalent CP15 instruction.

DMB ensures the observed ordering of memory accesses. Memory accesses of the specified type issued before the DMB are guaranteed to be observed (in the specified scope) before memory accesses issued after the DMB.

For example, DMB should be used between storing data, and updating a flag variable that makes that data available to another core.

The __dmb() intrinsic also acts as a compiler memory barrier of the appropriate type.