I have been trying to understand how Microsoft does overlapped (asynchronous) I/O, especially involving the OVERLAPPED structure and Event objects. I have spent hours reading the MSDN articles on these topics, but they are just so confusing.
In particular, can anyone clarify what the following passage means?
"Be careful when reusing OVERLAPPED structures. If an application reuses OVERLAPPED structures on multiple threads and calls GetOverlappedResult with the bWait parameter set to TRUE, the application must ensure that the associated event is set before the application reuses the structure. This can be accomplished by using the WaitForSingleObject function after calling GetOverlappedResult to force the thread to wait until the operation completes."
Maybe you could spell out a sequence of steps involving two threads in which the above problem arises. My brain is fried. Thanks :-)