Skip to content

PgLwLockExclusiveGuard<THeader, TElement>

Namespace: Ankus

Assembly: Ankus.Runtime.dll

Holds exclusive read/write access to a lock-protected header and its elements until disposal or callback exit.

public sealed class PgLwLockExclusiveGuard<THeader, TElement> : IDisposable where THeader : unmanaged where TElement : unmanaged

Type parameters:

THeader

The unmanaged header.

TElement

The unmanaged element.

Writes take effect immediately and are not rolled back by a transaction abort or exception.

Inheritance: object

Implements: IDisposable

Releases this guard once.

public void Dispose()

Mutate<TResult>(PgSharedArrayMutator<THeader, TElement, TResult>)

Section titled “Mutate<TResult>(PgSharedArrayMutator<THeader, TElement, TResult>)”

Updates the original header and elements through references limited to the synchronous callback.

public TResult Mutate<TResult>(PgSharedArrayMutator<THeader, TElement, TResult> mutator)

Type parameters:

TResult

The owned callback result.

Parameters:

mutator — PgSharedArrayMutator<THeader, TElement, TResult>

The mutator, whose references cannot escape the callback.

Returns: TResult

The callback result.

Read<TResult>(PgSharedArrayReader<THeader, TElement, TResult>)

Section titled “Read<TResult>(PgSharedArrayReader<THeader, TElement, TResult>)”

Reads the original header and elements through references limited to the synchronous callback.

public TResult Read<TResult>(PgSharedArrayReader<THeader, TElement, TResult> reader)

Type parameters:

TResult

The owned callback result.

Parameters:

reader — PgSharedArrayReader<THeader, TElement, TResult>

The reader, whose references cannot escape the callback.

Returns: TResult

The callback result.

Gets or sets a copy of the header while this guard holds the lock.

public THeader Header { get; set; }

Value: THeader

Gets or sets a copy of an element while this guard holds the lock.

public TElement this[int index] { get; set; }

Parameters:

index — int

The zero-based element index.

Value: TElement

The element.

Gets the number of elements.

public int Length { get; }

Value: int