System.Runtime.Remoting.Messaging.AsyncResult.AsyncWaitHandle Property

Gets a System.Threading.WaitHandle that encapsulates Win32 synchronization handles, and allows the implementation of various synchronization schemes.

Syntax

public virtual System.Threading.WaitHandle AsyncWaitHandle { get; }

Value

Documentation for this section has not yet been entered.

Remarks

The System.Threading.WaitHandle returned by this method is automatically signaled when the asynchronous operation has completed.

The wait handle is not closed automatically when you call EndInvoke on the delegate that was used to make the asynchronous method call. If you release all references to the wait handle, system resources are freed when garbage collection reclaims the wait handle. To free the system resources as soon as you are finished using the wait handle, call the System.Threading.WaitHandle.Close method. Garbage collection works more efficiently when disposable objects are explicitly closed or disposed.

Note:

The System.Threading.WaitHandle contained in the AsyncResult.AsyncWaitHandle property can be used to block the current thread until the asynchronous call is complete. However the System.Threading.WaitHandle will ignore the AsyncCallback, if one was specified during the BeginInvoke call. Therefore, a situation can occur where the application shuts down before the AsyncCallback has finished executing, even if a System.Threading.WaitHandle is used to block until the asynchronous call completion. For an example of such a situation, see the example for the System.Runtime.Remoting.Messaging.AsyncResult class, and remove the System.Threading.Thread.Sleep(int) statement.

Requirements

Namespace: System.Runtime.Remoting.Messaging
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0