Class AsyncReaderWriterLock
An asynchronous locker that provides read and write locking policies.
This is based on the following blog post: https://devblogs.microsoft.com/pfxteam/building-async-coordination-primitives-part-7-asyncreaderwriterlock/
Inherited Members
Namespace: SixLabors.ImageSharp.Web.Synchronization
Assembly: SixLabors.ImageSharp.Web.dll
Syntax
public class AsyncReaderWriterLock
Constructors
| Edit this page View SourceAsyncReaderWriterLock()
Initializes a new instance of the AsyncReaderWriterLock class.
Declaration
public AsyncReaderWriterLock()
Properties
| Edit this page View SourceOnRelease
Gets or sets the callback that should be invoked whenever this lock is released.
Declaration
public Action? OnRelease { get; set; }
Property Value
Type | Description |
---|---|
Action |
Methods
| Edit this page View SourceReaderLockAsync()
Asynchronously obtains the lock in shared reader mode. Dispose the returned IDisposable to release the lock.
Declaration
public Task<IDisposable> ReaderLockAsync()
Returns
Type | Description |
---|---|
Task<IDisposable> | The IDisposable that will release the lock. |
WriterLockAsync()
Asynchronously obtains the lock in exclusive writer mode. Dispose the returned IDisposable to release the lock.
Declaration
public Task<IDisposable> WriterLockAsync()
Returns
Type | Description |
---|---|
Task<IDisposable> | The IDisposable that will release the lock. |