System.Threading.Tasks.Task.WaitAll Method

Waits for all of the provided cancellable System.Threading.Tasks.Task objects to complete execution within a specified number of milliseconds.

Syntax

public static bool WaitAll (Task[] tasks, int millisecondsTimeout, System.Threading.CancellationToken cancellationToken)

Parameters

tasks
An array of System.Threading.Tasks.Task instances on which to wait.
millisecondsTimeout
The number of milliseconds to wait, or System.Threading.Timeout.Infinite (-1) to wait indefinitely.
cancellationToken
A TaskFactory.CancellationToken to observe while waiting for the tasks to complete.

Returns

true if all of the System.Threading.Tasks.Task instances completed execution within the allotted time; otherwise, false.

Remarks

The cancellationToken argument is used to cancel the wait operation. If it is canceled, the Wait returns false (False in Visual Basic). Cancellation of the tasks is a distinct operation, and is signaled by the AggregateException as noted above.

Requirements

Namespace: System.Threading.Tasks
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 4.0.0.0