November 20th, 2010, 05:50 AM
confused about overlapped I/O and Events
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 :-)
Tags for this Thread
Click Here to Expand Forum to Full Width
This is a Codeguru.com survey!