static class · System.Threading

Interlocked

public static class Interlocked

Atomic operations on numbers in memory reached by pointers (unsafe code): Interlocked.Add(&counts[i], 1).

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

Inheritance

Base classes
Any Interlocked

Methods

unsafe Add(i64* location, i64 value) : i64
#

static

unsafe Add(i32* location, i32 value) : i32
#

static

unsafe Increment(i64* location) : i64
#

static

unsafe Increment(i32* location) : i32
#

static

unsafe Decrement(i64* location) : i64
#

static

unsafe Decrement(i32* location) : i32
#

static

unsafe Exchange(i64* location, i64 value) : i64
#

static

unsafe Exchange(i32* location, i32 value) : i32
#

static

unsafe CompareExchange(i64* location, i64 value, i64 comparand) : i64
#

static

unsafe CompareExchange(i32* location, i32 value, i32 comparand) : i32
#

static

unsafe Read(i64* location) : i64
#

static

Private and internal members (7)

unsafe extern("atomic.add.i64") AddAt64(i64* at, i64 value) : i64
#

private static

unsafe extern("atomic.xchg.i64") ExchangeAt64(i64* at, i64 value) : i64
#

private static

unsafe extern("atomic.cas.i64") CompareAt64(i64* at, i64 expected, i64 value) : i64
#

private static

unsafe extern("atomic.load.i64") LoadAt64(i64* at) : i64
#

private static

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

private static

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

private static

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

private static

Inherited members (5)

Source

Interlocked as Antril, decompiled from its Larva HIR.

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

into namespace System.Threading
{
	/// Atomic operations on numbers in memory reached by pointers (unsafe code): `Interlocked.Add(&counts[i], 1)`.
	public static class Interlocked
	{
		unsafe extern("atomic.add.i64") AddAt64(i64* at, i64 value) : i64;

		unsafe extern("atomic.xchg.i64") ExchangeAt64(i64* at, i64 value) : i64;

		unsafe extern("atomic.cas.i64") CompareAt64(i64* at, i64 expected, i64 value) : i64;

		unsafe extern("atomic.load.i64") LoadAt64(i64* at) : i64;

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

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

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

		public:
			unsafe Add(i64* location, i64 value) : i64 => AddAt64(location, value) + value;

			unsafe Add(i32* location, i32 value) : i32 => AddAt32(location, value) + value;

			unsafe Increment(i64* location) : i64 => AddAt64(location, 1) + 1;

			unsafe Increment(i32* location) : i32 => AddAt32(location, 1) + 1;

			unsafe Decrement(i64* location) : i64 => AddAt64(location, -1) - 1;

			unsafe Decrement(i32* location) : i32 => AddAt32(location, -1) - 1;

			unsafe Exchange(i64* location, i64 value) : i64 => ExchangeAt64(location, value);

			unsafe Exchange(i32* location, i32 value) : i32 => ExchangeAt32(location, value);

			unsafe CompareExchange(i64* location, i64 value, i64 comparand) : i64 => CompareAt64(location, comparand, value);

			unsafe CompareExchange(i32* location, i32 value, i32 comparand) : i32 => CompareAt32(location, comparand, value);

			unsafe Read(i64* location) : i64 => LoadAt64(location);
	}
}
Esc