Skip to main content

Mojo package

atomic

Atomic operations and consistency models.

The atomic package provides the Atomic type for performing atomic read-modify-write operations on scalar values, along with the Consistency type for specifying the memory consistency model of those operations. It also exposes the fence function to create standalone memory barriers.

Use this package when implementing lock-free data structures, reference counting, or any other synchronization primitive that requires fine-grained control over memory ordering between threads.

Modules

Was this page helpful?