[Interest] QEventLoop ::hasPendingEvents() replacement?
Fabrice Mousset | GEOCEPT GmbH
fabrice.mousset at geocept.com
Wed Jun 26 08:58:53 CEST 2019
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!
> -----Ursprüngliche Nachricht-----
> Von: Interest <interest-bounces at qt-project.org> Im Auftrag von Thiago
> Gesendet: Dienstag, 25. Juni 2019 18:09
> An: interest at qt-project.org
> Betreff: Re: [Interest] QEventLoop ::hasPendingEvents() replacement?
> On Tuesday, 25 June 2019 08:00:02 PDT Fabrice Mousset | GEOCEPT GmbH
> > 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
More information about the Interest