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:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2013-05-08 17:23:17 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2013-05-08 17:23:17 +0400
commita07dcd67ebf63fad08536b1e78bbb61e18fa51e6 (patch)
tree7c96f23349f005187e87d19d23248bb40d4d2e91 /source/blender/blenlib/intern/threads.c
parent3e763d7e4dbbc4acb3deb7afb95e936ce950ebb5 (diff)
Fix #35240: command line -t number of threads option did not work for cycles.
Now it works for blender internal, cycles and other multithreading code in Blender in both background and UI mode.
Diffstat (limited to 'source/blender/blenlib/intern/threads.c')
-rw-r--r--source/blender/blenlib/intern/threads.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/source/blender/blenlib/intern/threads.c b/source/blender/blenlib/intern/threads.c
index 8b1ba38a35a..84a8af71dd5 100644
--- a/source/blender/blenlib/intern/threads.c
+++ b/source/blender/blenlib/intern/threads.c
@@ -115,6 +115,7 @@ static pthread_mutex_t _movieclip_lock = PTHREAD_MUTEX_INITIALIZER;
static pthread_mutex_t _colormanage_lock = PTHREAD_MUTEX_INITIALIZER;
static pthread_t mainid;
static int thread_levels = 0; /* threads can be invoked inside threads */
+static int num_threads_override = 0;
/* just a max for security reasons */
#define RE_MAX_THREAD BLENDER_MAX_THREADS
@@ -322,6 +323,9 @@ int BLI_system_thread_count(void)
t = (int)sysconf(_SC_NPROCESSORS_ONLN);
# endif
#endif
+
+ if (num_threads_override > 0)
+ return num_threads_override;
if (t > RE_MAX_THREAD)
return RE_MAX_THREAD;
@@ -331,6 +335,16 @@ int BLI_system_thread_count(void)
return t;
}
+void BLI_system_num_threads_override_set(int num)
+{
+ num_threads_override = num;
+}
+
+int BLI_system_num_threads_override_get(void)
+{
+ return num_threads_override;
+}
+
/* Global Mutex Locks */
void BLI_lock_thread(int type)