134 if ( QThread::currentThread() == qApp->thread() )
146 QSemaphore semaphoreMainThreadReady( 1 );
151 QSemaphore semaphoreWorkerThreadReady( 1 );
155 semaphoreMainThreadReady.acquire();
156 semaphoreWorkerThreadReady.acquire();
158 const std::function<void()> waitFunc = [&semaphoreMainThreadReady, &semaphoreWorkerThreadReady]()
163 semaphoreMainThreadReady.release();
166 semaphoreWorkerThreadReady.acquire();
169 QMetaObject::invokeMethod( qApp, waitFunc, Qt::QueuedConnection );
173 while ( !semaphoreMainThreadReady.tryAcquire( 1, 100 ) )
175 if ( feedback->isCanceled() )
177 semaphoreWorkerThreadReady.release();
187 semaphoreWorkerThreadReady.release();
190 QMetaObject::invokeMethod( qApp, func, Qt::BlockingQueuedConnection );