# MemoryOrdering

`import { MemoryOrdering } from "destack:sync";`

Memory ordering for atomic operations.

Specifies how memory accesses around atomic operations can be reordered.

```ds title="MemoryOrdering"
export enum MemoryOrdering {
    Relaxed,
    Acquire,
    Release,
    AcquireRelease,
    SequentiallyConsistent,
}
```

[language/library/src/sync/atomic.ds:8:19](https://github.com/destack-sh/destack/blob/main/language/library/src/sync/atomic.ds#L8-L19)

## Variants

### `Relaxed`

Atomicity without synchronization ordering.

### `Acquire`

Acquire ordering that prevents subsequent reads and writes from moving before a load.

### `Release`

Release ordering that prevents prior reads and writes from moving after a store.

### `AcquireRelease`

Combined acquire and release ordering.

### `SequentiallyConsistent`

Acquire-release ordering within one global total order.
