Task scheduler: Remove query for the pool's number of threads
authorSergey Sharybin <sergey.vfx@gmail.com>
Wed, 1 Mar 2017 11:51:51 +0000 (12:51 +0100)
committerSergey Sharybin <sergey.vfx@gmail.com>
Wed, 1 Mar 2017 17:00:54 +0000 (18:00 +0100)
Not really happy of per-pool threads limit, need to find better
approach to that. But at least it's possible to get rid of half
of the nastyness here by removing getter which was only used in
an assert statement.

That piece of code was already well-tested and this code becomes
obsolete in the new depsgraph and does no longer exists in blender
2.8 branch.

source/blender/blenkernel/intern/scene.c
source/blender/blenlib/BLI_task.h
source/blender/blenlib/intern/task.c

index 56bfe5d7ff176109d92aa2b1e42666f5fd8618e6..50f46748570931563d2eaf2ee4d8636003553d35 100644 (file)
@@ -1510,8 +1510,6 @@ static void scene_update_object_func(TaskPool * __restrict pool, void *taskdata,
                if (add_to_stats) {
                        StatisicsEntry *entry;
 
-                       BLI_assert(threadid < BLI_pool_get_num_threads(pool));
-
                        entry = MEM_mallocN(sizeof(StatisicsEntry), "update thread statistics");
                        entry->object = object;
                        entry->start_time = start_time;
index 08b9629610d777a4152f2ca4a22f4457f858e8e2..cd2054a5ec3fae6c4ec1483a8f5acf5d7e3be352 100644 (file)
@@ -98,9 +98,6 @@ void BLI_task_pool_cancel(TaskPool *pool);
 /* stop all worker threads */
 void BLI_task_pool_stop(TaskPool *pool);
 
-/* get number of threads allowed to be used by this pool */
-int BLI_pool_get_num_threads(TaskPool *pool);
-
 /* set number of threads allowed to be used by this pool */
 void BLI_pool_set_num_threads(TaskPool *pool, int num_threads);
 
index c4761e9f7efa59b51909aa67457a8dc49dbeefca..a65ef881afdfa0589dc9e1dcb7121774d4b97e38 100644 (file)
@@ -687,16 +687,6 @@ void BLI_task_pool_work_and_wait(TaskPool *pool)
        BLI_mutex_unlock(&pool->num_mutex);
 }
 
-int BLI_pool_get_num_threads(TaskPool *pool)
-{
-       if (pool->num_threads != 0) {
-               return pool->num_threads;
-       }
-       else {
-               return BLI_task_scheduler_num_threads(pool->scheduler);
-       }
-}
-
 void BLI_pool_set_num_threads(TaskPool *pool, int num_threads)
 {
        /* NOTE: Don't try to modify threads while tasks are running! */