diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-04-26 16:23:46 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-04-26 17:00:02 +0300 |
commit | e61ba39e7c3582c673955d51694799081532b857 (patch) | |
tree | 65654a9de65766dc8cf1aaa4804e29a6eced80fb /source | |
parent | e2f8bb56d6783585953934b08e3a937666a72acc (diff) |
Ensure task scheduler exists before any threading starts in Blender
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenlib/intern/threads.c | 5 |
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(); } } |