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

Nito.AsyncEx.AsyncConditionVariable

public sealed class AsyncConditionVariable
An async-compatible condition variable. This type uses Mesa-style semantics (the notifying tasks do not yield).
public int Id { get; }

Gets a semi-unique identifier for this asynchronous condition variable.

Creates an async-compatible condition variable associated with an async-compatible lock.

public void Notify()

Sends a signal to a single task waiting on this condition variable. The associated lock MUST be held when calling this method, and it will still be held when this method returns.

public void NotifyAll()

Sends a signal to all tasks waiting on this condition variable. The associated lock MUST be held when calling this method, and it will still be held when this method returns.

public void Wait(CancellationToken cancellationToken)

Synchronously waits for a signal on this condition variable. This method may block the calling thread. The associated lock MUST be held when calling this method, and it will still be held when this method returns, even if the method is cancelled.

public void Wait()

Synchronously waits for a signal on this condition variable. This method may block the calling thread. The associated lock MUST be held when calling this method, and it will still be held when this method returns.

public Task WaitAsync(CancellationToken cancellationToken)

Asynchronously waits for a signal on this condition variable. The associated lock MUST be held when calling this method, and it will still be held when this method returns, even if the method is cancelled.

public Task WaitAsync()

Asynchronously waits for a signal on this condition variable. The associated lock MUST be held when calling this method, and it will still be held when the returned task completes.