mbahar94 / qextserialport

Automatically exported from code.google.com/p/qextserialport
Other
0 stars 0 forks source link

did not emit bytesWritten() on windows. #103

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. somethimes, did not emit bytesWritten() 
2.
3.

What is the expected output? What do you see instead?

What version of the product are you using? On what operating system?
lastest

Please provide any additional information below.

Bellow is changed the overlapped event checking routine.
in win_qextserialport.cpp

void QextSerialPort::onWinEvent(HANDLE h)
...
#if 0//original
if (GetOverlappedResult(Win_Handle, o, & numBytes, false)) {
                    overlapsToDelete.append(o);
                    totalBytesWritten += numBytes;
                } else if( GetLastError() != ERROR_IO_INCOMPLETE ) {
                    overlapsToDelete.append(o);
                    qWarning() << "CommEvent overlapped write error:" << GetLastError();
                }

#else //changed 
bool result = false;
do
{
    result = GetOverlappedResult(Win_Handle, o, & numBytes, false);
    if(result)
    {
        overlapsToDelete.append(o);
        totalBytesWritten += numBytes;
        break;
    }
    else if (GetLastError() != ERROR_IO_INCOMPLETE)
    {
        overlapsToDelete.append(o);
        qWarning() << "CommEvent overlapped write error:" << GetLastError();
        break;
    }
}while(!result);
#endif

Original issue reported on code.google.com by tyranno1223 on 23 Aug 2011 at 7:33

GoogleCodeExporter commented 9 years ago

Original comment by dbzhang...@gmail.com on 13 Jun 2012 at 11:26