[Interest] How to avoid QProcess polling
Shantanu Tushar
shaan7in at gmail.com
Wed Apr 8 16:36:38 CEST 2015
Thanks for the reply. What I understand now is that while the poll for
reading was done away with, the poll for writing still remains. I have
created a bugreport at https://bugreports.qt.io/browse/QTBUG-45457 .
Hopefully I have explained the problem correctly there.
On Wed, Apr 8, 2015 at 4:18 PM, Joerg Bornemann <
joerg.bornemann at theqtcompany.com> wrote:
> On 08-Apr-15 09:21, Shantanu Tushar wrote:
>
> > Lets say I launch an external application on Windows using this code-
> [...polling in QProcess...]
>
> This polling code is there for historical reasons. It's a naive way to
> simulate a socket notifier for stdin. If there's no data to write the
> _q_notified call doesn't do much.
>
> > Right now I hack around this by doing this-
> >
> > QThread t;
> > QProcess p;
> > p.moveToThread(&t);
> > p.start("C:\\Windows\\notepad.exe");
> >
> > which basically causes the hasEventDispatcher() if condition to false
> > and no polling happens. However, this generates warnings because the
> > QProcess attempts to generate children. Further, I lose the ability to
> > read stdout from the process.
>
> That's a bad way to avoid the polling for reasons you already mentioned.
>
> > Is there a cleaner way to disable the polling? Or at least make it less
> > frequent? Just in case you're wondering, this is important because our
> > users are freaks about CPU utilization and they don't want to see >0%
> > CPU usage when the app is idle from their perspective.
>
> There's currently no way to disable the polling without changing Qt.
> You can change the NOTIFYTIMEOUT define to a higher number and rebuild
> Qt to make the polling less frequent.
> You might want to create a bug report with a justification why this
> issue is bad for you (apart from the fact that the current solution is
> inelegant).
>
>
> BR,
>
> Joerg
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>
--
Shantanu Tushar (UTC +0530)
shantanu.io
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20150408/215d392b/attachment.html>
More information about the Interest
mailing list