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

Method waitForThreadsToQuit_internal

Engine/GenericSchedulerThread.cpp:206–238  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Calls 1

onWaitForThreadToQuitMethod · 0.45

Tested by

no test coverage detected