PgSpinLockValue<T>
Namespace: Ankus
Assembly: Ankus.Runtime.dll
Embeds a PostgreSQL spinlock and unmanaged value inside a shared aggregate.
public readonly struct PgSpinLockValue<T> where T : unmanagedType parameters:
T
The unmanaged value protected by the spinlock.
Construct this field in the shared initializer and access it directly through the reference supplied by the owning shared value’s or lock guard’s Read callback. Default values and detached copies cannot be locked. Use PgSpinLock for ordinary local storage. Keep critical sections short and synchronous.
Constructors
Section titled “Constructors”PgSpinLockValue(T)
Section titled “PgSpinLockValue(T)”Initializes the selected PostgreSQL lock representation and the protected value.
public PgSpinLockValue(T value)Parameters:
value — T
The initial value.
Properties
Section titled “Properties”IsLocked
Section titled “IsLocked”Gets whether the lock is currently held, on PostgreSQL versions before 19.
public bool IsLocked { get; }Value: bool
This is an instantaneous observation, not permission to access the protected value. PostgreSQL 19 and later throw NotSupportedException because SpinLockFree was removed.
Methods
Section titled “Methods”Lock()
Section titled “Lock()”Acquires an exclusive guard within the current admitted shared read.
public PgSpinLockGuard<T> Lock()Returns: PgSpinLockGuard<T>
A guard released by disposal, shared-read exit or callback exit.