diff options
Diffstat (limited to 'tests/gtests/blenlib/BLI_linklist_lockfree_test.cc')
-rw-r--r-- | tests/gtests/blenlib/BLI_linklist_lockfree_test.cc | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/tests/gtests/blenlib/BLI_linklist_lockfree_test.cc b/tests/gtests/blenlib/BLI_linklist_lockfree_test.cc index 9934d1a3337..d1a527d57ac 100644 --- a/tests/gtests/blenlib/BLI_linklist_lockfree_test.cc +++ b/tests/gtests/blenlib/BLI_linklist_lockfree_test.cc @@ -63,9 +63,9 @@ struct IndexedNode { int index; }; -void concurrent_insert(TaskPool *__restrict pool, void *taskdata, int /*threadid*/) +void concurrent_insert(TaskPool *__restrict pool, void *taskdata) { - LockfreeLinkList *list = (LockfreeLinkList *)BLI_task_pool_userdata(pool); + LockfreeLinkList *list = (LockfreeLinkList *)BLI_task_pool_user_data(pool); CHECK_NOTNULL(list); IndexedNode *node = (IndexedNode *)MEM_mallocN(sizeof(IndexedNode), "test node"); node->index = POINTER_AS_INT(taskdata); @@ -76,22 +76,18 @@ void concurrent_insert(TaskPool *__restrict pool, void *taskdata, int /*threadid TEST(LockfreeLinkList, InsertMultipleConcurrent) { - static const int num_threads = 512; static const int num_nodes = 655360; /* Initialize list. */ LockfreeLinkList list; BLI_linklist_lockfree_init(&list); /* Initialize task scheduler and pool. */ - TaskScheduler *scheduler = BLI_task_scheduler_create(num_threads); - TaskPool *pool = BLI_task_pool_create_suspended(scheduler, &list, TASK_PRIORITY_HIGH); + TaskPool *pool = BLI_task_pool_create_suspended(&list, TASK_PRIORITY_HIGH); /* Push tasks to the pool. */ for (int i = 0; i < num_nodes; ++i) { BLI_task_pool_push(pool, concurrent_insert, POINTER_FROM_INT(i), false, NULL); } /* Run all the tasks. */ - BLI_threaded_malloc_begin(); BLI_task_pool_work_and_wait(pool); - BLI_threaded_malloc_end(); /* Verify we've got all the data properly inserted. */ EXPECT_EQ(list.head, &list.dummy_node); bool *visited_nodes = (bool *)MEM_callocN(sizeof(bool) * num_nodes, "visited nodes"); @@ -112,5 +108,4 @@ TEST(LockfreeLinkList, InsertMultipleConcurrent) /* Cleanup data. */ BLI_linklist_lockfree_free(&list, MEM_freeN); BLI_task_pool_free(pool); - BLI_task_scheduler_free(scheduler); } |