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:
authorSergey Sharybin <sergey.vfx@gmail.com>2017-04-26 16:23:46 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2017-04-26 17:00:02 +0300
commite61ba39e7c3582c673955d51694799081532b857 (patch)
tree65654a9de65766dc8cf1aaa4804e29a6eced80fb /source/blender/blenlib
parente2f8bb56d6783585953934b08e3a937666a72acc (diff)
Ensure task scheduler exists before any threading starts in Blender
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r--source/blender/blenlib/intern/threads.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/source/blender/blenlib/intern/threads.c b/source/blender/blenlib/intern/threads.c
index 77da3be0600..abf611d1245 100644
--- a/source/blender/blenlib/intern/threads.c
+++ b/source/blender/blenlib/intern/threads.c
@@ -813,6 +813,11 @@ void BLI_begin_threaded_malloc(void)
unsigned int level = atomic_fetch_and_add_u(&thread_levels, 1);
if (level == 0) {
MEM_set_lock_callback(BLI_lock_malloc_thread, BLI_unlock_malloc_thread);
+ /* There is a little chance that two threads will meed to acces to a
+ * scheduler which was not yet created from main thread. which could
+ * cause scheduler created multiple times.
+ */
+ BLI_task_scheduler_get();
}
}