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 sealed class AsyncLock : IDisposable
Constructors
| Edit this page View SourceAsyncLock()
Initializes a new instance of the AsyncLock class.
Declaration
public AsyncLock()
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 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. |