Free mag vol1 | Page 760

CHAPTER 19  MULTITHREADED, PARALLEL, AND ASYNC PROGRAMMING ***** Async Delegate Invocation ***** Main() invoked on thread 1. Doing more work in Main()! Add() invoked on thread 3. Doing more work in Main()! Doing more work in Main()! Doing more work in Main()! Doing more work in Main()! Doing more work in Main()! 10 + 10 is 20. In addition to the IsCompleted property, the IAsyncResult interface provides the AsyncWaitHandle property for more flexible waiting logic. This property returns an instance of the WaitHandle type, which exposes a method named WaitOne(). The benefit of WaitHandle.WaitOne() is that you can specify the maximum wait time. If the specified amount of time is exceeded, WaitOne() returns false. Ponder the following updated while loop, which no longer makes use of H