IAsyncResult.AsyncWaitHandle Property

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Gets a WaitHandle that is used to wait for an asynchronous operation to complete.

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

Syntax

'Declaration
ReadOnly Property AsyncWaitHandle As WaitHandle
WaitHandle AsyncWaitHandle { get; }

Property Value

Type: System.Threading.WaitHandle
A wait handle that is used to wait for an asynchronous operation to complete.

Remarks

The return value allows the client to wait for an asynchronous operation to complete instead of polling IsCompleted until the operation concludes. The return value can be used to perform a WaitOneWaitAny, or WaitAll operation.

The common language runtime supplies a number of waitable objects, such as ManualResetEvent and AutoResetEvent.

Notes to Implementers

The object that implements IAsyncResult does not need to create the WaitHandle until the AsyncWaitHandle property is read. It is the choice of the IAsyncResult implementer. However, if the implementer creates AsyncWaitHandle, it is the responsibility of the implementer to signal the WaitHandle that will terminate the wait at the appropriate time. Once created, AsyncWaitHandle should be kept alive until the user calls the method that concludes the asynchronous operation. At that time the object behind AsyncWaitHandle can be discarded.

Notes to Callers

Clients that wait for the operation to complete (instead of polling) use this property to obtain a synchronization object to wait on.

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.