.NET Framework Class Library |
CountdownEvent..::.Wait Method (CancellationToken) |
CountdownEvent Class See Also Send Feedback |
Blocks the current thread until the CountdownEvent is set, while
observing a CancellationToken.
Namespace:
System.Threading
Assembly:
System.Threading (in System.Threading.dll)
Syntax
Visual Basic (Declaration) |
---|
Public Sub Wait ( _ cancellationToken As CancellationToken _ ) |
C# |
---|
public void Wait( CancellationToken cancellationToken ) |
Parameters
- cancellationToken
- Type: System.Threading..::.CancellationToken
The CancellationToken to observe.
Remarks
The caller of this method blocks indefinitely until the current instance is set. The caller will
return immediately if the event is currently in a set state. If the
CancellationToken being observed
is canceled during the wait operation, an OperationCanceledException
will be thrown.
Exceptions
Exception | Condition |
---|---|
System..::.OperationCanceledException | cancellationToken has been canceled. |
System..::.ObjectDisposedException | The current instance has already been disposed. |