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 <oswald.buddenhagen@gmx.de>
This commit is contained in:
Alex Trotsenko 2020-12-14 19:10:17 +02:00
parent f2d22d5a51
commit c773fd297a

View File

@ -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 {