Fix #33107: cycles fixed threads 1 was still having two cores do work,
[blender.git] / intern / cycles / util / util_task.cpp
index ea0abd6f54f31eaf03b741027d86f98f326f58ca..8c4ec312256d94da575480024a83dcf9844bea51 100644 (file)
@@ -168,10 +168,16 @@ void TaskScheduler::init(int num_threads)
        if(users == 0) {
                do_exit = false;
 
-               /* launch threads that will be waiting for work */
-               if(num_threads == 0)
+               if(num_threads == 0) {
+                       /* automatic number of threads will be main thread + num cores */
                        num_threads = system_cpu_thread_count();
+               }
+               else {
+                       /* main thread will also work, for fixed threads we count it too */
+                       num_threads -= 1;
+               }
 
+               /* launch threads that will be waiting for work */
                threads.resize(num_threads);
                thread_level.resize(num_threads);