DotNext.Threading by Roman Sakno

<PackageReference Include="DotNext.Threading" Version="1.1.0" />

 AsyncReaderWriterLock

Represents asynchronous version of ReaderWriterLockSlim.
public long CurrentReadCount { get; }

Gets the total number of unique readers.

public bool IsReadLockHeld { get; }

Gets a value that indicates whether the read lock taken.

public bool IsUpgradeableReadLockHeld { get; }

Gets a value that indicates whether the current upgradeable read lock taken.

public bool IsWriteLockHeld { get; }

Gets a value that indicates whether the write lock taken.

Initializes a new reader/writer lock.

Enters the lock in read mode asynchronously.

public Task EnterReadLock(TimeSpan timeout)

Enters the lock in read mode asynchronously.

Enters the lock in upgradeable mode asynchronously.

Enters the lock in upgradeable mode asynchronously.

Enters the lock in write mode asynchronously.

public Task EnterWriteLock(TimeSpan timeout)

Enters the lock in write mode asynchronously.

public void ExitReadLock()

Exits read mode.

Exits upgradeable mode.

public void ExitWriteLock()

Exits write mode.

public Task<bool> TryEnterReadLock(TimeSpan timeout, CancellationToken token)

Tries to enter the lock in read mode asynchronously, with an optional time-out.

public Task<bool> TryEnterReadLock(TimeSpan timeout)

Tries to enter the lock in read mode asynchronously, with an optional time-out.

Tries to enter the lock in upgradeable mode asynchronously, with an optional time-out.

Tries to enter the lock in upgradeable mode asynchronously, with an optional time-out.

public Task<bool> TryEnterWriteLock(TimeSpan timeout, CancellationToken token)

Tries to enter the lock in write mode asynchronously, with an optional time-out.

public Task<bool> TryEnterWriteLock(TimeSpan timeout)

Tries to enter the lock in write mode asynchronously, with an optional time-out.