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.
Assembly: mscorlib (in mscorlib.dll)
Property Value
Type: System.Threading.WaitHandleA 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 ImplementersThe 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 CallersClients that wait for the operation to complete (instead of polling) use this property to obtain a synchronization object to wait on.