DotNext.Threading by .NET Foundation and Contributors

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

 AsyncEventHub

public class AsyncEventHub : IResettable
Represents a collection of asynchronous events.
public int Count { get; }

Gets the number of events.

public AsyncEventHub(int count)

Initializes a new collection of asynchronous events.

Cancels all suspended callers.

public void CaptureState(Span<bool> states)

Captures the state of the events.

public bool Pulse(int eventIndex)

Turns an event into the signaled state.

public int Pulse(ReadOnlySpan<int> eventIndexes)

Turns the specified events into signaled state.

public void Pulse(ReadOnlySpan<int> eventIndexes, Span<bool> flags)

Turns the specified events into signaled state.

public int PulseAll()

Turns all events into the signaled state.

public void PulseAll(Span<bool> flags)

Turns all events into the signaled state.

public void Reset()

Turns all events to non-signaled state.

public bool ResetAndPulse(int eventIndex)

Turns the specified event into the signaled state and reset all other events.

public int ResetAndPulse(ReadOnlySpan<int> eventIndexes)

Turns the specified events into signaled state and reset all other events.

public void ResetAndPulse(ReadOnlySpan<int> eventIndexes, Span<bool> flags)

Turns the specified events into signaled state and reset all other events.

public Task WaitAllAsync(ReadOnlySpan<int> eventIndexes, TimeSpan timeout, CancellationToken token = default)

Waits for all events.

public Task WaitAllAsync(ReadOnlySpan<int> eventIndexes, CancellationToken token = default)

Waits for all events.

public Task WaitAllAsync(TimeSpan timeout, CancellationToken token = default)

Waits for all events.

public Task WaitAllAsync(CancellationToken token = default)

Waits for all events.

public Task<int> WaitAnyAsync(ReadOnlySpan<int> eventIndexes, TimeSpan timeout, CancellationToken token = default)

Waits for any of the specified events.

public Task<int> WaitAnyAsync(ReadOnlySpan<int> eventIndexes, CancellationToken token = default)

Waits for any of the specified events.

public Task<int> WaitAnyAsync(TimeSpan timeout, CancellationToken token = default)

Waits for any of the specified events.

public Task<int> WaitAnyAsync(CancellationToken token = default)

Waits for any of the specified events.

public Task WaitOneAsync(int eventIndex, TimeSpan timeout, CancellationToken token = default)

Waits for the event represented by the specified index.

public Task WaitOneAsync(int eventIndex, CancellationToken token = default)

Waits for the event represented by the specified index.