summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Shienkov <denis.shienkov@gmail.com>2014-02-10 18:21:47 +0400
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-04-14 14:07:35 +0200
commit2360c401ae2012ed1b5a2b470a088cbbdb0d7f27 (patch)
tree03b6047df4614ec7dfd5a63a55084fc468c4018d
parent4a634dde17361f41b83c92f562714daf8aa51249 (diff)
downloadqtserialport-2360c401ae2012ed1b5a2b470a088cbbdb0d7f27.tar.gz
Do not start async read again if FIFO has no more data
The FIFO reading currently happens in chunks. The current operation starts reading again even if there is no byte available instead of waiting. This increases the overhead of the library needlessly. The correct thing to do is to wait instead of start reading again when the last chunk is already handled. Tested on Windows 8 using the on-board and the USB serial ports and using Qt4 and Qt5. Change-Id: I1926b853d1666b273d6d67b4a3f40261f1ed54ff Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Laszlo Papp <lpapp@kde.org>
-rw-r--r--src/serialport/qserialport_win.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/serialport/qserialport_win.cpp b/src/serialport/qserialport_win.cpp
index 2c15e94..0f453f5 100644
--- a/src/serialport/qserialport_win.cpp
+++ b/src/serialport/qserialport_win.cpp
@@ -610,7 +610,7 @@ void QSerialPortPrivate::_q_completeAsyncRead()
}
// start async read for possible remainder into driver queue
- if ((numberOfBytesTransferred > 0) && (policy == QSerialPort::IgnorePolicy))
+ if ((numberOfBytesTransferred == ReadChunkSize) && (policy == QSerialPort::IgnorePolicy))
startAsyncRead();
else // driver queue is emplty, so startup wait comm event
startAsyncCommunication();