Nito.AsyncEx.AsyncReaderWriterLock
A reader/writer lock that is compatible with async. Note that this lock is not recursive!
namespace Nito.AsyncEx
{
public sealed class AsyncReaderWriterLock
{
public int Id { get; }
public AsyncReaderWriterLock();
public AwaitableDisposable<IDisposable> ReaderLockAsync(CancellationToken cancellationToken);
public AwaitableDisposable<IDisposable> ReaderLockAsync();
public IDisposable ReaderLock(CancellationToken cancellationToken);
public IDisposable ReaderLock();
public AwaitableDisposable<IDisposable> WriterLockAsync(CancellationToken cancellationToken);
public AwaitableDisposable<IDisposable> WriterLockAsync();
public IDisposable WriterLock(CancellationToken cancellationToken);
public IDisposable WriterLock();
}
}