Export (0) Print
Expand All

IAsyncResult.AsyncWaitHandle Property

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

[Visual Basic]
ReadOnly Property AsyncWaitHandle As WaitHandle
[C#]
WaitHandle AsyncWaitHandle {get;}
[C++]
__property WaitHandle* get_AsyncWaitHandle();
[JScript]
function get AsyncWaitHandle() : WaitHandle;

Property Value

A WaitHandle 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 WaitOne, WaitAny, or WaitAll operation.

The common language runtime supplies a number of waitable objects, such as ManualResetEvent, AutoResetEvent, and Mutex, all of which mirror Win32 synchronization primitives.

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. For example, System.Runtime.Remoting.Messaging.AsyncResult terminates the wait on behalf of the caller when an asynchronously invoked method returns. 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 (as opposed to polling) use this property to obtain a synchronization object to wait on.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework, Common Language Infrastructure (CLI) Standard

See Also

IAsyncResult Interface | IAsyncResult Members | System Namespace

Show:
© 2014 Microsoft