[Qt-interest] How to block until posted event is processed?
Mihail Naydenov
mlists at ymail.com
Mon May 31 11:02:46 CEST 2010
Hi, Im trying to achieve this scenario;
void doWorkFromThreadAAA()
{
// ... work, work ...
QApplication::postEvent( objectOnThreadBBB, new WorkFinishedEvent);
//* NOW BLOCK UNTIL BBB HAS PROCESSED THE POSTED EVENT *//
}
I have tried two ways:
The noob one: sendEvent() - Which crashed with failed assertion about sending events across threads.
Sidenote: This is not documented!!!
The second one:
QAbstractEventDispatcher::instance(objectOnThreadBBB->thread())->processEvents(QEventLoop::AllEvents)
This one however crashed with the very same assertion.
My question is: Is the above scenario possible (without some cross-wired wait conditions), considering that "posted events are delived when control returns to the event loop" ... can I get around this?
Thank You
MihailNaydenov
More information about the Qt-interest-old
mailing list