DotNext.Threading by Roman Sakno

<PackageReference Include="DotNext.Threading" Version="3.2.0" />

 Synchronizer

public abstract class Synchronizer : Disposable, ISynchronizer
Provides a framework for implementing asynchronous locks and related synchronization primitives that doesn't rely on first-in-first-out (FIFO) wait queues.
public bool IsSet { get; }

Determines whether this event in signaled state.

public Task<bool> WaitAsync(TimeSpan timeout, CancellationToken token)

Suspends the caller until this event is set.

public Task<bool> WaitAsync<T>(Predicate<T> condition, T arg, TimeSpan timeout, CancellationToken token = default)

Suspends the caller until this event is set.

public Task WaitAsync<T>(Predicate<T> condition, T arg, CancellationToken token = default)

Suspends the caller until this event is set.

public Task<bool> WaitAsync<T1, T2>(Func<T1, T2, bool> condition, T1 arg1, T2 arg2, TimeSpan timeout, CancellationToken token = default)

Suspends the caller until this event is set.

public Task WaitAsync<T1, T2>(Func<T1, T2, bool> condition, T1 arg1, T2 arg2, CancellationToken token = default)

Suspends the caller until this event is set.