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.

Aliases

  • NOT_ATOMIC = Consistency(__init__[__mlir_type.!pop.int_literal](0)): Not atomic.
  • UNORDERED = Consistency(__init__[__mlir_type.!pop.int_literal](1)): Unordered.
  • MONOTONIC = Consistency(__init__[__mlir_type.!pop.int_literal](2)): Monotonic.
  • ACQUIRE = Consistency(__init__[__mlir_type.!pop.int_literal](3)): Acquire.
  • RELEASE = Consistency(__init__[__mlir_type.!pop.int_literal](4)): Release.
  • ACQUIRE_RELEASE = Consistency(__init__[__mlir_type.!pop.int_literal](5)): Acquire-release.
  • SEQUENTIAL = Consistency(__init__[__mlir_type.!pop.int_literal](6)): Sequentially consistent.

Implemented traits

AnyType, UnknownDestructibility

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.