Class AsyncBarrier
- Namespace
- Microsoft.VisualStudio.Threading
- Assembly
- Microsoft.VisualStudio.Threading.dll
An asynchronous barrier that blocks the signaler until all other participants have signaled.
public class AsyncBarrier
- Inheritance
-
AsyncBarrier
- Inherited Members
Constructors
AsyncBarrier(int)
Initializes a new instance of the AsyncBarrier class.
public AsyncBarrier(int participants)
Parameters
participants
intThe number of participants.
Methods
SignalAndWait()
Signals that a participant is ready, and returns a Task that completes when all other participants have also signaled ready.
public Task SignalAndWait()
Returns
- Task
A task which will complete (or may already be completed) when the last participant calls this method.
SignalAndWait(CancellationToken)
Signals that a participant is ready, and returns a Task that completes when all other participants have also signaled ready.
public ValueTask SignalAndWait(CancellationToken cancellationToken)
Parameters
cancellationToken
CancellationTokenA token that signals the caller's lost interest in waiting. The signal effect of the method is not canceled with the token.
Returns
- ValueTask
A task which will complete (or may already be completed) when the last participant calls this method.