PgAtomicValue<T>
Namespace: Ankus
Assembly: Ankus.Runtime.dll
Embeds one atomic scalar in an unmanaged shared aggregate.
public readonly struct PgAtomicValue<T> where T : unmanagedType parameters:
T
A primitive or enum type supported by Interlocked.
Operate directly on a field of the readonly reference supplied by a shared reader. Copying this value copies its current storage, not its identity. Each value occupies eight bytes and must be eight-byte aligned; packed unaligned layouts are rejected. Operations use Interlocked ordering.
Constructors
Section titled “Constructors”PgAtomicValue(T)
Section titled “PgAtomicValue(T)”Creates an inline atomic scalar with the supplied bits.
public PgAtomicValue(T value)Parameters:
value — T
The initial scalar.
Methods
Section titled “Methods”CompareExchange(T, T)
Section titled “CompareExchange(T, T)”Replaces the scalar when its bits match the comparand and returns its previous value.
public T CompareExchange(T value, T comparand)Parameters:
value — T
The replacement value when comparison succeeds.
comparand — T
The exact required bit pattern.
Returns: T
The value before comparison, whether or not replacement occurred.
Exchange(T)
Section titled “Exchange(T)”Atomically replaces the scalar and returns its previous value.
public T Exchange(T value)Parameters:
value — T
The replacement value.
Returns: T
The value before replacement.
Properties
Section titled “Properties”Gets the scalar atomically without copying its containing storage.
public T Value { get; }Value: T