217 if ( QThread::currentThread() == qApp->thread() )
229 QSemaphore semaphoreMainThreadReady( 1 );
234 QSemaphore semaphoreWorkerThreadReady( 1 );
238 semaphoreMainThreadReady.acquire();
239 semaphoreWorkerThreadReady.acquire();
241 const std::function<void()> waitFunc = [&semaphoreMainThreadReady, &semaphoreWorkerThreadReady]()
246 semaphoreMainThreadReady.release();
249 semaphoreWorkerThreadReady.acquire();
252 QMetaObject::invokeMethod( qApp, waitFunc, Qt::QueuedConnection );
256 while ( !semaphoreMainThreadReady.tryAcquire( 1, 100 ) )
258 if ( feedback->isCanceled() )
260 semaphoreWorkerThreadReady.release();
270 semaphoreWorkerThreadReady.release();
273 QMetaObject::invokeMethod( qApp, func, Qt::BlockingQueuedConnection );