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:
authorTon Roosendaal <ton@blender.org>2006-11-28 13:16:24 +0300
committerTon Roosendaal <ton@blender.org>2006-11-28 13:16:24 +0300
commitc1258980a4ac39d0b4b260c1ddc359c1675a3b25 (patch)
tree0247fff5620fd62702988633d14cf9f6e469108f /source/blender/blenlib/intern/threads.c
parent859dc7918b60965efa420813309d7adbc97f3ba8 (diff)
Render Baking upgrade:
- Now baking itself is threaded too (like for render, max 2 cpus. Moving this to 4 cpus is on todo. Goes twice as fast! - fix: ESC from bake was broken... - other fix: toolbox menus didn't treat sublevel string lengths OK, truncating items like for Group library names.
Diffstat (limited to 'source/blender/blenlib/intern/threads.c')
-rw-r--r--source/blender/blenlib/intern/threads.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/source/blender/blenlib/intern/threads.c b/source/blender/blenlib/intern/threads.c
index d9cf2ec0e57..f02bac9aef0 100644
--- a/source/blender/blenlib/intern/threads.c
+++ b/source/blender/blenlib/intern/threads.c
@@ -85,6 +85,7 @@ A sample loop can look like this (pseudo c);
************************************************ */
static pthread_mutex_t _malloc_lock = PTHREAD_MUTEX_INITIALIZER;
static pthread_mutex_t _custom1_lock = PTHREAD_MUTEX_INITIALIZER;
+static int thread_levels= 0; /* threads can be invoked inside threads */
/* just a max for security reasons */
#define RE_MAX_THREAD 8
@@ -126,6 +127,7 @@ void BLI_init_threads(ListBase *threadbase, void *(*do_thread)(void *), int tot)
}
MEM_set_lock_callback(BLI_lock_malloc_thread, BLI_unlock_malloc_thread);
+ thread_levels++;
}
/* amount of available threads */
@@ -194,7 +196,9 @@ void BLI_end_threads(ListBase *threadbase)
}
BLI_freelistN(threadbase);
- MEM_set_lock_callback(NULL, NULL);
+ thread_levels--;
+ if(thread_levels==0)
+ MEM_set_lock_callback(NULL, NULL);
}
void BLI_lock_thread(int type)