Table of Contents

Class AsyncReaderWriterLock

Namespace
SixLabors.ImageSharp.Web.Synchronization
Assembly
SixLabors.ImageSharp.Web.dll

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/

public class AsyncReaderWriterLock
Inheritance
AsyncReaderWriterLock
Inherited Members

Constructors

AsyncReaderWriterLock()

Initializes a new instance of the AsyncReaderWriterLock class.

public AsyncReaderWriterLock()

Properties

OnRelease

Gets or sets the callback that should be invoked whenever this lock is released.

public Action? OnRelease { get; set; }

Property Value

Action

Methods

ReaderLockAsync()

Asynchronously obtains the lock in shared reader mode. Dispose the returned IDisposable to release the lock.

public Task<IDisposable> ReaderLockAsync()

Returns

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.

public Task<IDisposable> WriterLockAsync()

Returns

Task<IDisposable>

The IDisposable that will release the lock.