Skip to content

PgDsmLwLock<T>

Namespace: Ankus

Assembly: Ankus.Runtime.dll

Holds a PostgreSQL lightweight lock and the value it protects inside dynamic shared memory, such as a parallel custom scan’s, as pgrx’s DsmLwLock does.

public struct PgDsmLwLock<T> where T : unmanaged

Type parameters:

T

The unmanaged value the lock protects.

Declare it as a field of the shared memory’s layout, initialize it in place in InitializeShared(TState, ref TShared), and acquire it through Share<T>(PgDsmLwLockSelector<TShared, T>) or Exclusive<T>(PgDsmLwLockSelector<TShared, T>). The first 64 bytes hold PostgreSQL’s lock; the value follows them.

Initializes the lock in place with a registered tranche and sets its value. Call it on the field in shared memory; a copy initializes only the copy.

public void Initialize(PgDsmLwLockTranche tranche, T value)

Parameters:

tranche — PgDsmLwLockTranche

The registered tranche.

value — T

The initial value.

Exceptions: