final class · System.Threading

AtomicI32

public final class AtomicI32

An i32 that threads change together (each operation is atomic). Add, Increment and Decrement give the new value, Exchange and CompareExchange the old one.

Kind
final class
Namespace
System.Threading
Assembly
System.Core
Access
public, final
Source file
Threading.ant

Inheritance

Base classes
Any AtomicI32

Constructors

new()
#
new(i32 value)
#

Properties

i32 Value { get; set; }
#

Methods

Load() : i32
#
Store(i32 v)
#
Add(i32 delta) : i32
#
Increment() : i32
#
Decrement() : i32
#
Exchange(i32 v) : i32
#
CompareExchange(i32 v, i32 comparand) : i32
#

Sets v if the value is comparand: the value before.

Private and internal members (6)

i32 value
#

private

static unsafe extern("atomic.load.i32") LoadAt(i32* at) : i32
#

private static

static unsafe extern("atomic.store.i32") StoreAt(i32* at, i32 value)
#

private static

static unsafe extern("atomic.add.i32") AddAt(i32* at, i32 value) : i32
#

private static

static unsafe extern("atomic.xchg.i32") ExchangeAt(i32* at, i32 value) : i32
#

private static

static unsafe extern("atomic.cas.i32") CompareAt(i32* at, i32 expected, i32 value) : i32
#

private static

Inherited members (5)

Source

AtomicI32 as Antril, decompiled from its Larva HIR.

System.Threading.AtomicI32.ant
// System.Threading.AtomicI32 — System.Core (decompiled from Larva HIR)

into namespace System.Threading
{
	/// An i32 that threads change together (each operation is atomic). Add, Increment and Decrement give the new value,
	/// Exchange and CompareExchange the old one.
	public final class AtomicI32
	{
		i32 value;

		static unsafe extern("atomic.load.i32") LoadAt(i32* at) : i32;

		static unsafe extern("atomic.store.i32") StoreAt(i32* at, i32 value);

		static unsafe extern("atomic.add.i32") AddAt(i32* at, i32 value) : i32;

		static unsafe extern("atomic.xchg.i32") ExchangeAt(i32* at, i32 value) : i32;

		static unsafe extern("atomic.cas.i32") CompareAt(i32* at, i32 expected, i32 value) : i32;

		public:
			new()
			{
			}

			new(i32 value)
			{
				this.value = value;
			}

			Load() : i32
			{
				unsafe
				{
					return LoadAt(&value);
				}
			}

			Store(i32 v)
			{
				unsafe
				{
					StoreAt(&value, v);
				}
			}

			Add(i32 delta) : i32
			{
				unsafe
				{
					return AddAt(&value, delta) + delta;
				}
			}

			Increment() : i32
			{
				unsafe
				{
					return AddAt(&value, 1) + 1;
				}
			}

			Decrement() : i32
			{
				unsafe
				{
					return AddAt(&value, -1) - 1;
				}
			}

			Exchange(i32 v) : i32
			{
				unsafe
				{
					return ExchangeAt(&value, v);
				}
			}

			/// Sets `v` if the value is `comparand`: the value before.
			CompareExchange(i32 v, i32 comparand) : i32
			{
				unsafe
				{
					return CompareAt(&value, comparand, v);
				}
			}

			i32 Value
			{
				get => Load();
				set
				{
					Store(value);
				}
			}
	}
}
Esc