SynchronizationContext.Wait(IntPtr[], Boolean, Int32) Method

Definition

Important

This API is not CLS-compliant.

CLS-compliant alternative
System.Threading.WaitHandle.WaitAll(WaitHandle[], TimeSpan, Boolean)

Waits for any or all the elements in the specified array to receive a signal.

C#
[System.CLSCompliant(false)]
public virtual int Wait(IntPtr[] waitHandles, bool waitAll, int millisecondsTimeout);
C#
[System.CLSCompliant(false)]
[System.Security.SecurityCritical]
public virtual int Wait(IntPtr[] waitHandles, bool waitAll, int millisecondsTimeout);

Parameters

waitHandles

IntPtr[]

An array of type IntPtr that contains the native operating system handles.

waitAll
Boolean

true to wait for all handles; false to wait for any handle.

millisecondsTimeout
Int32

The number of milliseconds to wait, or Infinite (-1) to wait indefinitely.

Returns

The array index of the object that satisfied the wait.

Attributes

Exceptions

waitHandles is null.

Remarks

The Wait method calls the external declaration WaitHelper to perform the wait activity. Override the Wait method to change the wait behavior for the synchronization context.

Applies to

Product Versions
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1