PgLwLock<T>
Namespace: Ankus
Assembly: Ankus.Runtime.dll
Describes an unmanaged shared value protected by a PostgreSQL lightweight reader/writer lock.
public sealed class PgLwLock<T> where T : unmanagedType parameters:
T
The unmanaged value stored in shared memory.
Keep this descriptor in a static field and register it with PgSharedMemory. Each guard belongs to the acquiring callback and backend thread. Recursive acquisition is rejected. Use a using declaration to release a guard promptly; callback exit also releases it. Native addresses embedded in T must be valid across processes, including Windows workers.
Inheritance: object
Constructors
Section titled “Constructors”PgLwLock(string)
Section titled “PgLwLock(string)”Creates an unregistered descriptor with a cluster-wide shared-memory name.
public PgLwLock(string name)Parameters:
name — string
A nonempty, exact UTF-8 name without a zero byte.
Methods
Section titled “Methods”Exclusive()
Section titled “Exclusive()”Acquires exclusive read/write access, waiting for all other holders to release the lock.
public PgLwLockExclusiveGuard<T> Exclusive()Returns: PgLwLockExclusiveGuard<T>
A callback-scoped exclusive guard.
Share()
Section titled “Share()”Acquires shared read access, waiting for an exclusive writer to release the lock.
public PgLwLockShareGuard<T> Share()Returns: PgLwLockShareGuard<T>
A callback-scoped shared guard.
Properties
Section titled “Properties”Gets the exact name used by PostgreSQL’s shared-memory index and named lock tranche.
public string Name { get; }Value: string