Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'intern/cycles/util/util_task.cpp')
-rw-r--r--intern/cycles/util/util_task.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/intern/cycles/util/util_task.cpp b/intern/cycles/util/util_task.cpp
index ea0abd6f54f..8c4ec312256 100644
--- a/intern/cycles/util/util_task.cpp
+++ b/intern/cycles/util/util_task.cpp
@@ -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);