136 if ( QThread::currentThread() == qApp->thread() )
148 QSemaphore semaphoreMainThreadReady( 1 );
153 QSemaphore semaphoreWorkerThreadReady( 1 );
157 semaphoreMainThreadReady.acquire();
158 semaphoreWorkerThreadReady.acquire();
160 const std::function<void()> waitFunc = [&semaphoreMainThreadReady, &semaphoreWorkerThreadReady]()
165 semaphoreMainThreadReady.release();
168 semaphoreWorkerThreadReady.acquire();
171 QMetaObject::invokeMethod( qApp, waitFunc, Qt::QueuedConnection );
175 while ( !semaphoreMainThreadReady.tryAcquire( 1, 100 ) )
177 if ( feedback->isCanceled() )
179 semaphoreWorkerThreadReady.release();
189 semaphoreWorkerThreadReady.release();
192 QMetaObject::invokeMethod( qApp, func, Qt::BlockingQueuedConnection );