Why does GetOverlappedResult need a file descriptor?

Why GetOverlappedResult need a file descriptor?

It seems that WaitForSingleObject(overlapped->hEvent) should be enough to wait for the event to complete the I / O overlap, so what GetOverlappedResult use a file descriptor for?

+4
source share
1 answer

The notes section of the documentation explains when hFile is required:

If the hEvent member of the OVERLAPPED structure is NULL, the system uses the state of the hFile handle to signal when the operation is complete. The use of files, named channels or communication devices for this purpose is not recommended. It is safer to use an event object due to confusion that can occur when several simultaneous overlapping operations are performed in a single file, named pipe or communication device. In this situation, there is no way to find out which operation caused the state of the object.

+3
source

Source: https://habr.com/ru/post/1482492/


All Articles