Class AsyncLock
An asynchronous locker that uses an IDisposable pattern for releasing the lock.
Implements
Inherited Members
Namespace: SixLabors.ImageSharp.Web.Synchronization
Assembly: SixLabors.ImageSharp.Web.dll
Syntax
public class AsyncLock : IDisposable
Constructors
| Improve this Doc View SourceAsyncLock()
Initializes a new instance of the AsyncLock class.
Declaration
public AsyncLock()
Properties
| Improve this Doc 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
| Improve this Doc View SourceDispose()
Releases all resources used by the current instance of the AsyncLock class.
Declaration
public void Dispose()
LockAsync()
Asynchronously obtains the lock. Dispose the returned IDisposable to release the lock.
Declaration
public Task<IDisposable> LockAsync()
Returns
Type | Description |
---|---|
Task<IDisposable> | The IDisposable that will release the lock. |