MCPcopy Create free account
hub / github.com/NatronGitHub/Natron / waitForThreadsToQuit_internal

Method waitForThreadsToQuit_internal

Engine/GenericSchedulerThread.cpp:210–242  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

208}
209
210bool
211GenericSchedulerThreadPrivate::waitForThreadsToQuit_internal(bool allowBlockingForMainThread)
212{
213 if ( !_p->isRunning() ) {
214 return false;
215 }
216
217 {
218 QMutexLocker k(&threadStateMutex);
219 if (threadState == GenericSchedulerThread::eThreadStateStopped) {
220 return false;
221 }
222 }
223
224 // This function may NOT be called on the main-thread, because we may deadlock if executeOnMainThread is called OR block the UI.
225 if ( !allowBlockingForMainThread && ( QThread::currentThread() == qApp->thread() ) ) {
226 return false;
227 }
228
229 {
230 QMutexLocker k(&mustQuitMutex);
231 while (mustQuit) {
232 mustQuitCond.wait(k.mutex());
233 }
234 }
235
236 // call pthread_join() to ensure the thread has stopped, this should be instantaneous anyway since we ensured we returned from the run() function already
237 _p->wait();
238
239 _p->onWaitForThreadToQuit();
240
241 return true;
242}
243
244void
245GenericSchedulerThread::waitForThreadToQuitQueued_main_thread(bool allowRestart)

Calls 1

onWaitForThreadToQuitMethod · 0.45

Tested by

no test coverage detected