Overlapped IO and ERROR_IO_INCOMPLETE

I had overlapping IO work for 2 years, but I used it with a new application and threw this error at me (when I hide the main form).

I have googled, but I don’t understand what the error means and how should I handle it?

Any ideas?

Im using this over NamedPipes, and the error occurs after calling GetOverlappedResult

DWORD dwWait = WaitForMultipleObjects(getNumEvents(), m_hEventsArr, FALSE, 500);

//check result. Get correct data

BOOL fSuccess = GetOverlappedResult(data->hPipe, &data->oOverlap, &cbRet, FALSE);

// error happens here
+3
source share
1 answer

ERROR_IO_INCOMPLETE- This is an error code, which means that the Overlapped operation is still in progress; GetOverlappedResultreturns false because the operation has not yet been completed.

You have two options: lock and non-block:

: GetOverlappedResult :

BOOL fSuccess = GetOverlappedResult(data->hPipe, &data->oOverlap, &cbRet, TRUE);

, Overlapped ( ) .

:, , :

BOOL fSuccess = GetOverlappedResult(data->hPipe, &data->oOverlap, &cbRet, FALSE);
if (!fSuccess) {
    if (GetLastError() == ERROR_IO_INCOMPLETE) return; // operation still in progress

    /* handle error */
} else {
    /* handle success */
}

, , . , , , .)

+6

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


All Articles