summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qwindowspipewriter.cpp
diff options
context:
space:
mode:
authorAlex Trotsenko <alex1973tr@gmail.com>2021-04-12 16:31:51 +0300
committerOswald Buddenhagen <oswald.buddenhagen@gmx.de>2021-04-15 19:00:42 +0000
commit063cdb9870ab8a9b0f1a3741a001c06289f02af4 (patch)
tree3dcba5254f8ae4d2f250ffadaec0f93f865048e7 /src/corelib/io/qwindowspipewriter.cpp
parent92d351089bf7e285c9800342ff72205c04984f6c (diff)
QWindowsPipe{Reader|Writer}: restructure signals
For QProcess, there is no point in suppressing recursive QWPR::readyRead() emission, as the former manages this logic itself. On top of that, the non-recursive nature of QWPR::readyRead() indirectly disallowed reading from the channels inside QProcess::waitForReadyRead(), if that is called from a slot connected to QProcess::readyRead(). QWPW had two signals, one allowing recursion and one not. This commit allows recursion of QWPR::readyRead() and QWPW::bytesWritten(), and moves recursion suppression to the higher- level classes. This makes the code more uniform and efficient, at the cost of a few duplicated lines. Change-Id: Ib20017fff4d92403d0bf2335f1622de4aa1ddcef Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Diffstat (limited to 'src/corelib/io/qwindowspipewriter.cpp')
-rw-r--r--src/corelib/io/qwindowspipewriter.cpp14
1 files changed, 3 insertions, 11 deletions
diff --git a/src/corelib/io/qwindowspipewriter.cpp b/src/corelib/io/qwindowspipewriter.cpp
index 4b075549d0d..f2f4dce056e 100644
--- a/src/corelib/io/qwindowspipewriter.cpp
+++ b/src/corelib/io/qwindowspipewriter.cpp
@@ -39,7 +39,6 @@
****************************************************************************/
#include "qwindowspipewriter_p.h"
-#include <qscopedvaluerollback.h>
#include <qcoreapplication.h>
#include <QMutexLocker>
@@ -56,8 +55,7 @@ QWindowsPipeWriter::QWindowsPipeWriter(HANDLE pipeWriteEnd, QObject *parent)
stopped(true),
writeSequenceStarted(false),
bytesWrittenPending(false),
- winEventActPosted(false),
- inBytesWritten(false)
+ winEventActPosted(false)
{
ZeroMemory(&overlapped, sizeof(OVERLAPPED));
overlapped.hEvent = eventHandle;
@@ -290,12 +288,7 @@ bool QWindowsPipeWriter::consumePendingAndEmit(bool allowWinActPosting)
if (stopped)
return false;
- emit canWrite();
- if (!inBytesWritten) {
- QScopedValueRollback<bool> guard(inBytesWritten, true);
- emit bytesWritten(numberOfBytesWritten);
- }
-
+ emit bytesWritten(numberOfBytesWritten);
return true;
}
@@ -317,8 +310,7 @@ bool QWindowsPipeWriter::waitForNotification(const QDeadlineTimer &deadline)
/*!
Waits for the completion of the asynchronous write operation.
- Returns \c true, if we've emitted the bytesWritten signal (non-recursive case)
- or bytesWritten will be emitted by the event loop (recursive case).
+ Returns \c true, if we've emitted the bytesWritten signal.
*/
bool QWindowsPipeWriter::waitForWrite(int msecs)
{