144 if ( QThread::currentThread() == qApp->thread() )
156 QSemaphore semaphoreMainThreadReady( 1 );
161 QSemaphore semaphoreWorkerThreadReady( 1 );
165 semaphoreMainThreadReady.acquire();
166 semaphoreWorkerThreadReady.acquire();
168 const std::function<void()> waitFunc = [&semaphoreMainThreadReady, &semaphoreWorkerThreadReady]()
173 semaphoreMainThreadReady.release();
176 semaphoreWorkerThreadReady.acquire();
179 QMetaObject::invokeMethod( qApp, waitFunc, Qt::QueuedConnection );
183 while ( !semaphoreMainThreadReady.tryAcquire( 1, 100 ) )
185 if ( feedback->isCanceled() )
187 semaphoreWorkerThreadReady.release();
197 semaphoreWorkerThreadReady.release();
200 QMetaObject::invokeMethod( qApp, func, Qt::BlockingQueuedConnection );