[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [58792] branches/soc-2013-depsgraph_mt/ source/blender/blenlib/intern/threads.c: Made task scheduler follow command line argument number of threads

Sergey Sharybin sergey.vfx at gmail.com
Wed Jul 31 23:56:00 CEST 2013


Revision: 58792
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=58792
Author:   nazgul
Date:     2013-07-31 21:56:00 +0000 (Wed, 31 Jul 2013)
Log Message:
-----------
Made task scheduler follow command line argument number of threads

Modified Paths:
--------------
    branches/soc-2013-depsgraph_mt/source/blender/blenlib/intern/threads.c

Modified: branches/soc-2013-depsgraph_mt/source/blender/blenlib/intern/threads.c
===================================================================
--- branches/soc-2013-depsgraph_mt/source/blender/blenlib/intern/threads.c	2013-07-31 21:55:54 UTC (rev 58791)
+++ branches/soc-2013-depsgraph_mt/source/blender/blenlib/intern/threads.c	2013-07-31 21:56:00 UTC (rev 58792)
@@ -148,9 +148,7 @@
 
 void BLI_threadapi_init(void)
 {
-	int tot_thread = BLI_system_thread_count();
 	mainid = pthread_self();
-	task_scheduler = BLI_task_scheduler_create(tot_thread);
 }
 
 void BLI_threadapi_exit(void)
@@ -160,6 +158,15 @@
 
 TaskScheduler *BLI_task_scheduler_get(void)
 {
+	if (task_scheduler == NULL) {
+		int tot_thread = BLI_system_thread_count();
+
+		/* Do a lazy initialization, so it happes after
+		 * command line arguments parsing
+		 */
+		task_scheduler = BLI_task_scheduler_create(tot_thread);
+	}
+
 	return task_scheduler;
 }
 




More information about the Bf-blender-cvs mailing list