From what I can tell from the MSDN pages on AcceptEx
and the OVERLAPPED
structure, when AcceptEx
completes it should set the OVERLAPPED::hEvent
handle to signalled.
From MSDN page of OVERLAPPED
A handle to the event that will be set to a signaled state by the system when the operation has completed. The user must initialize this member either to zero or a valid event handle using the CreateEvent function before passing this structure to any overlapped functions.
Its talking fairly broadly here, which I would say is safe to assume it applies to all functions taking an OVERLAPPED
structure.
If your AcceptEx
never returns true, it may be that you have a bug in your code. Unless you post actual code, will be hard to tell what that might be.
In the same page on OVERLAPPED
it says this about ReadFile
Functions such as ReadFile and WriteFile set this handle to the nonsignaled state before they begin an I/O operation. When the operation has completed, the handle is set to the signaled state.
With regards to calling GetOverlappedResult
it also states specifically what to do:
Functions such as GetOverlappedResult
and the synchronization wait functions reset auto-reset events to the nonsignaled state. Therefore, you should use a manual reset event; if you use an auto-reset event, your application can stop responding if you wait for the operation to complete and then call GetOverlappedResult with the bWait parameter set to TRUE.
Like @HansPassant said in the comments, don't use it.