Skip to content

ReaderLockAsync Method ​

Definition ​

  • Namespace: JASE
  • Assembly: JASE.Concurrency.dll

Overloads ​

NameDescription
ValueTask<LockHandle> ReaderLockAsync()Acquires a reader lock asynchronously.
ValueTask<LockHandle> ReaderLockAsync(CancellationToken cancellationToken)Acquires a reader lock asynchronously.
ValueTask<LockHandle> ReaderLockAsync(int timeoutMs, CancellationToken cancellationToken = null)Acquires a reader lock asynchronously, waiting at most timeoutMs milliseconds.
ValueTask<LockHandle> ReaderLockAsync(TimeSpan timeout, CancellationToken cancellationToken = null)Acquires a reader lock asynchronously, waiting at most timeout.

ValueTask<LockHandle> ReaderLockAsync() ​

csharp
ValueTask<LockHandle> ReaderLockAsync()

Acquires a reader lock asynchronously.

Returns ​

A disposable handle that releases the reader lock.

ValueTask<LockHandle> ReaderLockAsync(int timeoutMs, CancellationToken cancellationToken = null) ​

csharp
ValueTask<LockHandle> ReaderLockAsync(int timeoutMs, CancellationToken cancellationToken = null)

Acquires a reader lock asynchronously, waiting at most timeoutMs milliseconds.

Parameters ​

NameDescription
cancellationTokenToken used to cancel the wait.
timeoutMsMaximum time to wait in milliseconds. When zero or negative, LockEntranceTimeout is used.

Returns ​

A disposable handle that releases the reader lock.

ValueTask<LockHandle> ReaderLockAsync(CancellationToken cancellationToken) ​

csharp
ValueTask<LockHandle> ReaderLockAsync(CancellationToken cancellationToken)

Acquires a reader lock asynchronously.

Parameters ​

NameDescription
cancellationTokenToken used to cancel the wait. Does not cancel an already-held lock.

Returns ​

A disposable handle that releases the reader lock.

ValueTask<LockHandle> ReaderLockAsync(TimeSpan timeout, CancellationToken cancellationToken = null) ​

csharp
ValueTask<LockHandle> ReaderLockAsync(TimeSpan timeout, CancellationToken cancellationToken = null)

Acquires a reader lock asynchronously, waiting at most timeout.

Parameters ​

NameDescription
cancellationTokenToken used to cancel the wait.
timeoutMaximum time to wait. Must be greater than zero.

Returns ​

A disposable handle that releases the reader lock.