Skip to main content

Mojo struct

Consistency

@register_passable(trivial) struct Consistency

Represents the consistency model for atomic operations.

The class provides a set of constants that represent different consistency models for atomic operations.

Attributes: NOT_ATOMIC: Not atomic. UNORDERED: Unordered. MONOTONIC: Monotonic. ACQUIRE: Acquire. RELEASE: Release. ACQUIRE_RELEASE: Acquire-release. SEQUENTIAL: Sequentially consistent.

Implemented traits

AnyType, Copyable, Movable, UnknownDestructibility

Aliases

ACQUIRE

alias ACQUIRE = Consistency(3)

Acquire.

ACQUIRE_RELEASE

alias ACQUIRE_RELEASE = Consistency(5)

Acquire-release.

MONOTONIC

alias MONOTONIC = Consistency(2)

Monotonic.

NOT_ATOMIC

alias NOT_ATOMIC = Consistency(0)

Not atomic.

RELEASE

alias RELEASE = Consistency(4)

Release.

SEQUENTIAL

alias SEQUENTIAL = Consistency(6)

Sequentially consistent.

UNORDERED

alias UNORDERED = Consistency(1)

Unordered.

Methods

__init__

__init__(value: SIMD[uint8, 1]) -> Self

Constructs a new Consistency object.

Args:

  • value (SIMD[uint8, 1]): The value of the consistency model.

__eq__

__eq__(self, other: Self) -> Bool

Compares two Consistency objects for equality.

Args:

  • other (Self): The other Consistency object to compare with.

Returns:

True if the objects are equal, False otherwise.

__ne__

__ne__(self, other: Self) -> Bool

Compares two Consistency objects for inequality.

Args:

  • other (Self): The other Consistency object to compare with.

Returns:

True if the objects are not equal, False otherwise.

__is__

__is__(self, other: Self) -> Bool

Checks if the Consistency object is the same as another.

Args:

  • other (Self): The other Consistency object to compare with.

Returns:

True if the objects are the same, False otherwise.

__isnot__

__isnot__(self, other: Self) -> Bool

Checks if the Consistency object is not the same as another.

Args:

  • other (Self): The other Consistency object to compare with.

Returns:

True if the objects are not the same, False otherwise.

__mlir_attr

__mlir_attr(self) -> !kgen.deferred

Returns the MLIR attribute representation of the Consistency object.

Returns:

The MLIR attribute representation of the Consistency object.

Was this page helpful?