summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDenis Shienkov <denis.shienkov@gmail.com>2014-07-19 19:53:16 +0400
committerDenis Shienkov <denis.shienkov@gmail.com>2014-08-02 11:20:26 +0200
commitd402b2cd84fc55c6c9399bb4fc9e1ad764c07cde (patch)
treee004d3e75f693c4c9b24cb4900c705ec93395c83 /src
parent72c6169b21793da91b3e652ae5f1e21c45c067d3 (diff)
downloadqtserialport-d402b2cd84fc55c6c9399bb4fc9e1ad764c07cde.tar.gz
Make the QSerialPort::flush() non-blocking
According to documentation, the flush() method shall be non-blocking. Tested on Linux 64-bit with auto-tests with the on-board and the USB serial ports for Qt4 and then Qt5. Note: On Windows the flush() method still does not work. Change-Id: Iaee80361e59e0c281206ca24c817a446cdbf6ed1 Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/serialport/qserialport_unix.cpp7
-rw-r--r--src/serialport/qserialport_win.cpp15
2 files changed, 2 insertions, 20 deletions
diff --git a/src/serialport/qserialport_unix.cpp b/src/serialport/qserialport_unix.cpp
index 11ab16f..d555805 100644
--- a/src/serialport/qserialport_unix.cpp
+++ b/src/serialport/qserialport_unix.cpp
@@ -337,12 +337,7 @@ bool QSerialPortPrivate::setRequestToSend(bool set)
bool QSerialPortPrivate::flush()
{
- return completeAsyncWrite()
-#ifndef Q_OS_ANDROID
- && (::tcdrain(descriptor) != -1);
-#else
- && (::ioctl(descriptor, TCSBRK, 1) != -1);
-#endif
+ return completeAsyncWrite();
}
bool QSerialPortPrivate::clear(QSerialPort::Directions directions)
diff --git a/src/serialport/qserialport_win.cpp b/src/serialport/qserialport_win.cpp
index eccaca9..19f35b7 100644
--- a/src/serialport/qserialport_win.cpp
+++ b/src/serialport/qserialport_win.cpp
@@ -259,20 +259,7 @@ bool QSerialPortPrivate::setRequestToSend(bool set)
bool QSerialPortPrivate::flush()
{
- Q_Q(QSerialPort);
-
- bool returnValue = true;
-
- if (!startAsyncWrite())
- returnValue = false;
-
- if (!::FlushFileBuffers(handle)) {
- q->setError(decodeSystemError());
- returnValue = false;
- }
-
- return returnValue;
-
+ return startAsyncWrite();
}
bool QSerialPortPrivate::clear(QSerialPort::Directions directions)