enum

Atomic::Ordering

Inherits Enum / Comparable / Value / Object

Specifies how memory accesses, including non atomic, are to be reordered around atomics. Follows the C/C++ semantics: https://en.cppreference.com/w/c/atomic/memory_order.

By default atomics use the sequentially consistent ordering, which has the strongest guarantees. If all you need is to increment a counter, a relaxed ordering may be enough. If you need to synchronize access to other memory (e.g. locks) you may try the acquire/release semantics that may be faster on some architectures (e.g. X86) but remember that an acquire must be paired with a release for the ordering to be guaranteed.

The code generation always enforces the selected memory order, even on weak CPU architectures (e.g. ARM32), with the exception of the Relaxed memory order where only the operation itself is atomic.

Constants

Relaxed = 2
Acquire = 4
Release = 5
AcquireRelease = 6
SequentiallyConsistent = 7

Instance methods

acquire?

Returns true if this enum value equals Acquire

Source
acquire_release?

Returns true if this enum value equals AcquireRelease

Source
relaxed?

Returns true if this enum value equals Relaxed

Source
release?

Returns true if this enum value equals Release

Source
sequentially_consistent?

Returns true if this enum value equals SequentiallyConsistent

Source