Share via


WaitHandle.WaitAny Method (WaitHandle[], Int32, Boolean)

Waits for any of the elements in the specified array to receive a signal, using a 32-bit signed integer to measure the time interval, and specifying whether to exit the synchronization domain before the wait.

Namespace: System.Threading
Assembly: mscorlib (in mscorlib.dll)

Syntax

public static int WaitAny (
         WaitHandle[] waitHandles,
         intmillisecondsTimeout,
         boolexitContext
)

Parameters

  • waitHandles
    A WaitHandle array containing the objects for which the current instance will wait.
  • millisecondsTimeout
    The number of milliseconds to wait, or -1 to wait indefinitely.
  • exitContext
    true to exit the synchronization domain for the context before the wait (if in a synchronized context), and reacquire it afterward; otherwise, false.

Return Value

The array index of the object that satisfied the wait, or WaitTimeout if no object satisfied the wait and a time interval equivalent to millisecondsTimeout has passed.

See Also

Reference

WaitHandle Class
WaitHandle Members
System.Threading Namespace