AsyncWaitHandle Property
Collapse the table of content
Expand the table of content

IAsyncResult.AsyncWaitHandle Property

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

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

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

WaitHandle AsyncWaitHandle { get; }

Property Value

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

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.

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Show:
© 2017 Microsoft