Skip to main content
Log in

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(__init__[__mlir_type.!pop.int_literal](3))

Acquire.

ACQUIRE_RELEASE

alias ACQUIRE_RELEASE = Consistency(__init__[__mlir_type.!pop.int_literal](5))

Acquire-release.

MONOTONIC

alias MONOTONIC = Consistency(__init__[__mlir_type.!pop.int_literal](2))

Monotonic.

NOT_ATOMIC

alias NOT_ATOMIC = Consistency(__init__[__mlir_type.!pop.int_literal](0))

Not atomic.

RELEASE

alias RELEASE = Consistency(__init__[__mlir_type.!pop.int_literal](4))

Release.

SEQUENTIAL

alias SEQUENTIAL = Consistency(__init__[__mlir_type.!pop.int_literal](6))

Sequentially consistent.

UNORDERED

alias UNORDERED = Consistency(__init__[__mlir_type.!pop.int_literal](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.