From c773fd297abd5ae0f5bc1148c289f41066bf3fd8 Mon Sep 17 00:00:00 2001 From: Alex Trotsenko Date: Mon, 14 Dec 2020 19:10:17 +0200 Subject: QProcess/Unix: speed up initialization of write notifier By using new QSocketNotifier API, we can avoid unnecessarily enabling the notifier right before turning it off again. Change-Id: Ie0dea00251e9885653677c495dfc5abaaa4db1c7 Reviewed-by: Oswald Buddenhagen --- src/corelib/io/qprocess_unix.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/corelib/io') diff --git a/src/corelib/io/qprocess_unix.cpp b/src/corelib/io/qprocess_unix.cpp index cc753541a2..07d427047d 100644 --- a/src/corelib/io/qprocess_unix.cpp +++ b/src/corelib/io/qprocess_unix.cpp @@ -259,9 +259,8 @@ bool QProcessPrivate::openChannel(Channel &channel) // create the socket notifiers if (threadData.loadRelaxed()->hasEventDispatcher()) { if (&channel == &stdinChannel) { - channel.notifier = new QSocketNotifier(channel.pipe[1], - QSocketNotifier::Write, q); - channel.notifier->setEnabled(false); + channel.notifier = new QSocketNotifier(QSocketNotifier::Write, q); + channel.notifier->setSocket(channel.pipe[1]); QObject::connect(channel.notifier, SIGNAL(activated(QSocketDescriptor)), q, SLOT(_q_canWrite())); } else { -- cgit v1.2.3