Made task scheduler follow command line argument number of threads

This commit is contained in:
Sergey Sharybin
2013-07-31 21:56:00 +00:00
parent f5db3dc220
commit a196de9a79

View File

@@ -148,9 +148,7 @@ static void BLI_unlock_malloc_thread(void)
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 @@ void BLI_threadapi_exit(void)
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;
}