WaitHandle.WaitAll Method (WaitHandle, Int32)
Assembly: mscorlib (in mscorlib.dll)
An array that contains the objects for which the current instance will wait. This array cannot contain multiple references to the same object.
Return ValueType: System.Boolean
true when every element in waitHandles has received a signal; otherwise, false.
The waitHandles parameter is null. -or-
One or more of the objects in the waitHandles array is null.
The waitHandles array contains elements that are duplicates.
waitHandles is an array with no elements.
The number of objects in waitHandles is greater than the system permits.
millisecondsTimeout is a negative number other than -1, which represents an infinite time-out.
If millisecondsTimeout is zero, the method does not block. It tests the state of the wait handles and returns immediately.
The WaitAll method returns when the wait terminates, either when all the handles are signaled or when a time-out occurs. On some implementations, if more than 64 handles are passed, a NotSupportedException is thrown. If there are duplicates in the array, the call fails with an ArgumentException.
If you call this method from a single-threaded apartment, and waitHandles contains more than one wait handle, the method deadlocks.
Windows PhoneWaitAll is present but not supported in Windows Phone.
The following example shows how to use this overload of the WaitAll method to report progress while waiting for multiple threads to finish. Each time the WaitAll method times out, the thread that was waiting reports progress to the user interface thread.
This code is part of a larger example provided for the WaitHandle class.