summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qwindowspipereader_p.h
diff options
context:
space:
mode:
authorKai Koehne <kai.koehne@qt.io>2020-11-19 16:06:05 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2020-11-20 13:28:31 +0000
commitce29ce586f06f56a66198b934f8860946380e26e (patch)
treeb6c17c8e4261fd1e40b1d075b10a75bf4e6b5a38 /src/corelib/io/qwindowspipereader_p.h
parent5509449daf699958c212f4d14060c2c2af902317 (diff)
Revert "Allow QWindowsPipe{Reader,Writer} to work with foreign event loops"
This reverts commit ee122077b09430da54ca09750589b37326a22d85. Reason for revert: This causes QProcess::readAll() to sometimes return nothing after the process has ended. Fixes: QTBUG-88624 Change-Id: I34fa27ae7fb38cc7c3a1e8eb2fdae2a5775584c2 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io> (cherry picked from commit 23100ee61e33680d20f934dcbc96b57e8da29bf9) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/corelib/io/qwindowspipereader_p.h')
-rw-r--r--src/corelib/io/qwindowspipereader_p.h39
1 files changed, 19 insertions, 20 deletions
diff --git a/src/corelib/io/qwindowspipereader_p.h b/src/corelib/io/qwindowspipereader_p.h
index 5974833a86..2842343597 100644
--- a/src/corelib/io/qwindowspipereader_p.h
+++ b/src/corelib/io/qwindowspipereader_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2020 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtCore module of the Qt Toolkit.
@@ -52,7 +52,6 @@
//
#include <qobject.h>
-#include <qmutex.h>
#include <private/qringbuffer_p.h>
#include <qt_windows.h>
@@ -70,7 +69,7 @@ public:
void startAsyncRead();
void stop();
- void setMaxReadBufferSize(qint64 size);
+ void setMaxReadBufferSize(qint64 size) { readBufferMaxSize = size; }
qint64 maxReadBufferSize() const { return readBufferMaxSize; }
bool isPipeClosed() const { return pipeBroken; }
@@ -80,41 +79,41 @@ public:
bool waitForReadyRead(int msecs);
bool waitForPipeClosed(int msecs);
- bool isReadOperationActive() const;
+ bool isReadOperationActive() const { return readSequenceStarted; }
Q_SIGNALS:
void winError(ulong, const QString &);
void readyRead();
void pipeClosed();
-
-protected:
- bool event(QEvent *e) override;
+ void _q_queueReadyRead(QPrivateSignal);
private:
- void startAsyncReadLocked();
- static void CALLBACK waitCallback(PTP_CALLBACK_INSTANCE instance, PVOID context,
- PTP_WAIT wait, TP_WAIT_RESULT waitResult);
- void readCompleted(DWORD errorCode, DWORD numberOfBytesRead);
+ static void CALLBACK readFileCompleted(DWORD errorCode, DWORD numberOfBytesTransfered,
+ OVERLAPPED *overlappedBase);
+ void notified(DWORD errorCode, DWORD numberOfBytesRead);
DWORD checkPipeState();
bool waitForNotification(int timeout);
- bool emitPendingSignals(bool allowWinActPosting);
+ void emitPendingReadyRead();
+
+ class Overlapped : public OVERLAPPED
+ {
+ Q_DISABLE_COPY_MOVE(Overlapped)
+ public:
+ explicit Overlapped(QWindowsPipeReader *reader);
+ void clear();
+ QWindowsPipeReader *pipeReader;
+ };
HANDLE handle;
- HANDLE eventHandle;
- HANDLE syncHandle;
- PTP_WAIT waitObject;
- OVERLAPPED overlapped;
+ Overlapped overlapped;
qint64 readBufferMaxSize;
QRingBuffer readBuffer;
qint64 actualReadBufferSize;
- qint64 pendingReadBytes;
- mutable QMutex mutex;
- DWORD lastError;
bool stopped;
bool readSequenceStarted;
+ bool notifiedCalled;
bool pipeBroken;
bool readyReadPending;
- bool winEventActPosted;
bool inReadyRead;
};