DotNext.Threading by .NET Foundation and Contributors

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

 AsyncCountdownEvent

Represents a synchronization primitive that is signaled when its count reaches zero.
public long CurrentCount { get; }

Gets the number of remaining signals required to set the event.

public long InitialCount { get; }

Gets the numbers of signals initially required to set the event.

public bool IsSet { get; }

Indicates whether this event is set.

public AsyncCountdownEvent(long initialCount, int concurrencyLevel)

Creates a new countdown event with the specified count.

public AsyncCountdownEvent(long initialCount)

Creates a new countdown event with the specified count.

public void AddCount(long signalCount)

Increments the current count by a specified value.

public void AddCount()

Increments the current count by one.

public bool Reset()

Resets the CurrentCount to the value of InitialCount.

public bool Reset(long count)

Resets the InitialCount property to a specified value.

public bool Signal(long signalCount = 1)

Registers multiple signals with this object, decrementing the value of CurrentCount by the specified amount.

public bool TryAddCount(long signalCount)

Attempts to increment the current count by a specified value.

public bool TryAddCount()

Attempts to increment the current count by one.

public ValueTask<bool> WaitAsync(TimeSpan timeout, CancellationToken token = default)

Turns caller into idle state until the current event is set.

public ValueTask WaitAsync(CancellationToken token = default)

Turns caller into idle state until the current event is set.