Skip to content

PgLwLockShareGuard<THeader, TElement>

Namespace: Ankus

Assembly: Ankus.Runtime.dll

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

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

Type parameters:

THeader

The unmanaged header.

TElement

The unmanaged element.

Inheritance: object

Implements: IDisposable

Releases this guard once.

public void Dispose()

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 a copy of the header while this guard holds the lock.

public THeader Header { get; }

Value: THeader

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

public TElement this[int index] { get; }

Parameters:

index — int

The zero-based element index.

Value: TElement

The element.

Gets the number of elements.

public int Length { get; }

Value: int