256 if ( QThread::currentThread() == qApp->thread() )
268 QSemaphore semaphoreMainThreadReady( 1 );
273 QSemaphore semaphoreWorkerThreadReady( 1 );
277 semaphoreMainThreadReady.acquire();
278 semaphoreWorkerThreadReady.acquire();
280 const std::function<void()> waitFunc = [&semaphoreMainThreadReady, &semaphoreWorkerThreadReady]() {
284 semaphoreMainThreadReady.release();
287 semaphoreWorkerThreadReady.acquire();
290 QMetaObject::invokeMethod( qApp, waitFunc, Qt::QueuedConnection );
294 while ( !semaphoreMainThreadReady.tryAcquire( 1, 100 ) )
296 if ( feedback->isCanceled() )
298 semaphoreWorkerThreadReady.release();
308 semaphoreWorkerThreadReady.release();
311 QMetaObject::invokeMethod( qApp, func, Qt::BlockingQueuedConnection );