summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qwindowspipewriter_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/qwindowspipewriter_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/qwindowspipewriter_p.h')
-rw-r--r--src/corelib/io/qwindowspipewriter_p.h42
1 files changed, 21 insertions, 21 deletions
diff --git a/src/corelib/io/qwindowspipewriter_p.h b/src/corelib/io/qwindowspipewriter_p.h
index b5a48e926f..39e8ffe40a 100644
--- a/src/corelib/io/qwindowspipewriter_p.h
+++ b/src/corelib/io/qwindowspipewriter_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.
@@ -54,9 +54,7 @@
#include <QtCore/private/qglobal_p.h>
#include <qelapsedtimer.h>
#include <qobject.h>
-#include <qmutex.h>
-#include <private/qringbuffer_p.h>
-
+#include <qbytearray.h>
#include <qt_windows.h>
QT_BEGIN_NAMESPACE
@@ -119,37 +117,39 @@ public:
bool write(const QByteArray &ba);
void stop();
bool waitForWrite(int msecs);
- bool isWriteOperationActive() const;
+ bool isWriteOperationActive() const { return writeSequenceStarted; }
qint64 bytesToWrite() const;
Q_SIGNALS:
void canWrite();
void bytesWritten(qint64 bytes);
-
-protected:
- bool event(QEvent *e) override;
+ void _q_queueBytesWritten(QPrivateSignal);
private:
- void startAsyncWriteLocked();
- static void CALLBACK waitCallback(PTP_CALLBACK_INSTANCE instance, PVOID context,
- PTP_WAIT wait, TP_WAIT_RESULT waitResult);
- void writeCompleted(DWORD errorCode, DWORD numberOfBytesWritten);
+ static void CALLBACK writeFileCompleted(DWORD errorCode, DWORD numberOfBytesTransfered,
+ OVERLAPPED *overlappedBase);
+ void notified(DWORD errorCode, DWORD numberOfBytesWritten);
bool waitForNotification(int timeout);
- bool emitPendingSignals(bool allowWinActPosting);
+ void emitPendingBytesWrittenValue();
+
+ class Overlapped : public OVERLAPPED
+ {
+ Q_DISABLE_COPY_MOVE(Overlapped)
+ public:
+ explicit Overlapped(QWindowsPipeWriter *pipeWriter);
+ void clear();
+
+ QWindowsPipeWriter *pipeWriter;
+ };
HANDLE handle;
- HANDLE eventHandle;
- HANDLE syncHandle;
- PTP_WAIT waitObject;
- OVERLAPPED overlapped;
- QRingBuffer writeBuffer;
+ Overlapped overlapped;
+ QByteArray buffer;
qint64 pendingBytesWrittenValue;
- mutable QMutex mutex;
- DWORD lastError;
bool stopped;
bool writeSequenceStarted;
+ bool notifiedCalled;
bool bytesWrittenPending;
- bool winEventActPosted;
bool inBytesWritten;
};