<PackageReference Include="Nito.AsyncEx.Coordination" Version="5.1.0" />

Nito.AsyncEx.AsyncWaitQueueExtensions

Provides extension methods for wait queues.
public static Task<T> Enqueue<T>(this IAsyncWaitQueue<T> this, object mutex, CancellationToken token)

Creates a new entry and queues it to this wait queue. If the cancellation token is already canceled, this method immediately returns a canceled task without modifying the wait queue.