diff options
author | Joerg Bornemann <joerg.bornemann@theqtcompany.com> | 2015-04-16 13:46:45 +0200 |
---|---|---|
committer | Joerg Bornemann <joerg.bornemann@theqtcompany.com> | 2015-04-16 15:45:53 +0000 |
commit | bb8f62148052e1208b4fe00a3fc6f25fa74432ac (patch) | |
tree | 4f5e0cff186ae8c15616c42c65ab97afd860f357 /src | |
parent | 5fc52ba6e2a5425ea8edcef8aad80d9d20f47f9c (diff) |
remove emitReadyReadTimer from QWindowsPipeReader
The zero timeout singleshot timer emitReadyReadTimer was used to emit
the readyRead signal via the event loop in case of a synchronous read.
In that particular case, ReadFile would return successfully, and the
notified slot would not be called.
Now, that we use an I/O completion port, the notified slot is always
called, even in the synchronous case. The emitReadyReadTimer is not
needed anymore.
This is also supported by the fact that the timer is immediately
stopped in notified() after it was started in completeAsyncRead().
Change-Id: I93bcde5f067bf89a1d49005a3fddda4c8c8c95fc
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/io/qwindowspipereader.cpp | 9 | ||||
-rw-r--r-- | src/corelib/io/qwindowspipereader_p.h | 2 |
2 files changed, 0 insertions, 11 deletions
diff --git a/src/corelib/io/qwindowspipereader.cpp b/src/corelib/io/qwindowspipereader.cpp index 8b1ec83833..64f21d5a92 100644 --- a/src/corelib/io/qwindowspipereader.cpp +++ b/src/corelib/io/qwindowspipereader.cpp @@ -36,7 +36,6 @@ #include <qdebug.h> #include <qelapsedtimer.h> #include <qeventloop.h> -#include <qtimer.h> QT_BEGIN_NAMESPACE @@ -46,12 +45,9 @@ QWindowsPipeReader::QWindowsPipeReader(QObject *parent) readBufferMaxSize(0), actualReadBufferSize(0), readSequenceStarted(false), - emitReadyReadTimer(new QTimer(this)), pipeBroken(false), readyReadEmitted(false) { - emitReadyReadTimer->setSingleShot(true); - connect(emitReadyReadTimer, SIGNAL(timeout()), SIGNAL(readyRead())); dataReadNotifier = new QWinOverlappedIoNotifier(this); connect(dataReadNotifier, &QWinOverlappedIoNotifier::notified, this, &QWindowsPipeReader::notified); } @@ -146,8 +142,6 @@ qint64 QWindowsPipeReader::read(char *data, qint64 maxlen) } if (!pipeBroken) { - if (!actualReadBufferSize) - emitReadyReadTimer->stop(); if (!readSequenceStarted) startAsyncRead(); if (readSoFar == 0) @@ -177,7 +171,6 @@ void QWindowsPipeReader::notified(quint32 numberOfBytesRead, quint32 errorCode, return; } startAsyncRead(); - emitReadyReadTimer->stop(); readyReadEmitted = true; emit readyRead(); } @@ -266,8 +259,6 @@ bool QWindowsPipeReader::completeAsyncRead(DWORD bytesRead, DWORD errorCode) actualReadBufferSize += bytesRead; readBuffer.truncate(actualReadBufferSize); - if (!emitReadyReadTimer->isActive()) - emitReadyReadTimer->start(); return true; } diff --git a/src/corelib/io/qwindowspipereader_p.h b/src/corelib/io/qwindowspipereader_p.h index ecc6974efa..6eead60fd5 100644 --- a/src/corelib/io/qwindowspipereader_p.h +++ b/src/corelib/io/qwindowspipereader_p.h @@ -47,7 +47,6 @@ #include <qbytearray.h> #include <qobject.h> -#include <qtimer.h> #include <private/qringbuffer_p.h> #include <qt_windows.h> @@ -100,7 +99,6 @@ private: QRingBuffer readBuffer; int actualReadBufferSize; bool readSequenceStarted; - QTimer *emitReadyReadTimer; bool pipeBroken; bool readyReadEmitted; }; |