[Bf-blender-cvs] [e61ba39e7c3] master: Ensure task scheduler exists before any threading starts in Blender

Sergey Sharybin noreply at git.blender.org
Wed Apr 26 16:00:21 CEST 2017


Commit: e61ba39e7c3582c673955d51694799081532b857
Author: Sergey Sharybin
Date:   Wed Apr 26 15:23:46 2017 +0200
Branches: master
https://developer.blender.org/rBe61ba39e7c3582c673955d51694799081532b857

Ensure task scheduler exists before any threading starts in Blender

===================================================================

M	source/blender/blenlib/intern/threads.c

===================================================================

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();
 	}
 }




More information about the Bf-blender-cvs mailing list