| 1907 | } |
| 1908 | |
| 1909 | void |
| 1910 | OutputSchedulerThread::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 | |
| 1943 | RenderEngine* |
| 1944 | OutputSchedulerThread::getEngine() const |
nothing calls this directly
no test coverage detected