OpenMP and processEvents()
-
Hello,
I'm facing a problem when trying to refresh GUI during a big computation.
I have something like this
@
int main()
{
#pragma omp parallel for
for( int i=0; i<stop; i++ )
heavyStuff(i);
}void heavyStuff(int i)
{
for( int j=0; j<maxJ;j++ )
{
// lengthy computation
doSomething();// would like to processEvents here, but we are in a thread! qApp->processEvents();
}
@ -
Sorry but I haven't understand your problem ?? what problem r u facing ??
-
Thanks for looking at my problem.
Is that ok to call qApp->processEvents(); from any thread? -
[quote]void QCoreApplication::processEvents()
Processes all pending events for the calling thread according to the specified flags until there are no more events to process.[/quote]
So, yes. It should be "okay". But it only processes the pending events for the calling thread. You probably want to call this from the "main" thread - at least if your goal is to keep the UI "responsive" during a lengthy operation.