Asynchronous callbacks, IAsyncResult, WaitHandles
- Making asynchronous callback delegates use member functions works well for associating state with the callback.
- The IAsyncResult returned by a Begin function is the same object (but at a different time) as the argument passed to the callback.
- See Ref. Waiting on the IAsyncResult’s WaitHandle will not suspend the thread until the callback completes. Probably just until the async operation completes. It is possible to write code that does the begin & end sequentially with an optional WaitOne in the middle and no callback at all. This makes sense if you have some other stuff you could finish sequentially before you need the result of the operation (otherwise you’d just use the synchronous call which is really just a begin-wait-end sandwitch (with the end doing an explicit wait internally). The Async Pattern.