Den 3. nov. 2012 kl. 00:54 skrev Greg Ewing email@example.com:
I don't follow. Isn't the point of WaitForMultipleObjects that you can make a single call that blocks until any kind of object is ready?
WaitForMultipleObjects will wait for a "wait object" to be signalled – i.e. a thread, process, event, mutex, or semaphore handle.
The Unix select() function signals that a file object is ready for read or write. There are different functions to poll file objects for readyness in Windows, depending on their type. That is different from Unix which treats all files the same.
When WaitForMultipleObjects is used with overlapped i/o and IOCP, the OVERLAPPED struct has an event object that is signalled on completion (the hEvent member). It is not a wait on the file handle itself. WaitForMultipleObjects cannot wait for a file.