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

Method stopRenderThreads

Engine/OutputSchedulerThread.cpp:1909–1941  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1907}
1908
1909void
1910OutputSchedulerThread::stopRenderThreads(int nThreadsToStop)
1911{
1912#ifndef NATRON_PLAYBACK_USES_THREAD_POOL
1913 {
1914 ///First flag the number of threads to stop
1915 QMutexLocker l(&_imp->renderThreadsMutex);
1916 int i = 0;
1917 for (RenderThreads::iterator it = _imp->renderThreads.begin();
1918 it != _imp->renderThreads.end() && (i < nThreadsToStop || nThreadsToStop == 0); ++it) {
1919 if ( !it->thread->mustQuit() ) {
1920 it->thread->scheduleForRemoval();
1921 ++i;
1922 }
1923 }
1924
1925 ///Clean-up remaining zombie threads that are no longer useful
1926 _imp->removeAllQuitRenderThreads();
1927 }
1928
1929
1930 ///Wake-up all threads to make sure that they are notified that they must quit
1931 {
1932 QMutexLocker framesLocker(&_imp->framesToRenderMutex);
1933 _imp->framesToRenderNotEmptyCond.wakeAll();
1934 }
1935
1936#else
1937 Q_UNUSED(nThreadsToStop);
1938 QMutexLocker l(&_imp->renderThreadsMutex);
1939 _imp->waitForRenderThreadsToBeDone();
1940#endif
1941}
1942
1943RenderEngine*
1944OutputSchedulerThread::getEngine() const

Callers

nothing calls this directly

Calls 6

mustQuitMethod · 0.80
scheduleForRemovalMethod · 0.80
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected