Can't you use a QRunnable / QThreadPool with maxThreadCount=1?

> Sent: Wednesday, June 26, 2019 at 1:58 AM
> From: "Fabrice Mousset | GEOCEPT GmbH" <[email protected]>
> To: "Thiago Macieira" <[email protected]>, "[email protected]" 
> <[email protected]>
> Subject: Re: [Interest] QEventLoop ::hasPendingEvents() replacement?
>
> Hi Thiago,
> 
> thank's a lot for you answer and for your explanation.
> Sadly for me, replacing with true/false is not an alternative for my use case.
> I will have to rework the whole process.
> I have a worker class (with his own thread), and before allowing a new task 
> to be started I have to be sure previous task has been finished.
> Depending on the type of task there are more or less slots which are 
> triggered and depending on the parameter each slots could also trigger 
> another slots.
> hasPendingEvents() was a very attractive solution for my use case, too bad 
> for me!
> 
> Fabrice Mousset
> 
> > -----Ursprüngliche Nachricht-----
> > Von: Interest <[email protected]> Im Auftrag von Thiago
> > Macieira
> > Gesendet: Dienstag, 25. Juni 2019 18:09
> > An: [email protected]
> > Betreff: Re: [Interest] QEventLoop ::hasPendingEvents() replacement?
> > 
> > On Tuesday, 25 June 2019 08:00:02 PDT Fabrice Mousset | GEOCEPT GmbH
> > wrote:
> > > Hi all,
> > >
> > > Since Qt 5.3 QAbstractEventDispatcher::hasPendingEvents() has been set
> > > "obsolete". Is there an alternate way to know if a QEventLoop has
> > > pending events?
> > 
> > The reason it's obsolete is that it's a race condition. Since the race 
> > can't be
> > fixed, there will be no replacement.
> > 
> > I suggest you replace the call with "true" or "false", depending on how your
> > code around it would react to an event being posted by another thread at
> > just the wrong moment.
> > 
> > --
> > Thiago Macieira - thiago.macieira (AT) intel.com
> >   Software Architect - Intel System Software Products
> > 
> 
> _______________________________________________
> Interest mailing list
> [email protected]
> https://lists.qt-project.org/listinfo/interest
>
_______________________________________________
Interest mailing list
[email protected]
https://lists.qt-project.org/listinfo/interest

Reply via email to