Wait Method (CancellationToken)

Task Parallel System.Threading

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

ExceptionCondition
System..::.OperationCanceledExceptioncancellationToken has been canceled.
System..::.ObjectDisposedExceptionThe current instance has already been disposed.

See Also