diff options
author | Jacques Lucke <jacques@blender.org> | 2022-02-09 15:08:04 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2022-02-09 15:08:04 +0300 |
commit | 7c10e364b2358f08fa49ce35fc98d4de1431e615 (patch) | |
tree | 0e5cf3a6845ad8229dc3ce9988e16b0caa29b460 /source/blender/blenlib/tests/BLI_task_test.cc | |
parent | 3f061ef050ccb671f9c4c9b65a17f0d097e24344 (diff) |
BLI: wrap parallel_invoke from tbb
Diffstat (limited to 'source/blender/blenlib/tests/BLI_task_test.cc')
-rw-r--r-- | source/blender/blenlib/tests/BLI_task_test.cc | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/source/blender/blenlib/tests/BLI_task_test.cc b/source/blender/blenlib/tests/BLI_task_test.cc index 3bb6f6f753c..1ed732c1f18 100644 --- a/source/blender/blenlib/tests/BLI_task_test.cc +++ b/source/blender/blenlib/tests/BLI_task_test.cc @@ -1,6 +1,7 @@ /* Apache License, Version 2.0 */ #include "testing/testing.h" +#include <atomic> #include <cstring> #include "atomic_ops.h" @@ -12,6 +13,7 @@ #include "BLI_listbase.h" #include "BLI_mempool.h" #include "BLI_task.h" +#include "BLI_task.hh" #define NUM_ITEMS 10000 @@ -280,3 +282,15 @@ TEST(task, ListBaseIter) MEM_freeN(items_buffer); BLI_threadapi_exit(); } + +TEST(task, ParallelInvoke) +{ + std::atomic<int> counter = 0; + blender::threading::parallel_invoke([&]() { counter++; }, + [&]() { counter++; }, + [&]() { counter++; }, + [&]() { counter++; }, + [&]() { counter++; }, + [&]() { counter++; }); + EXPECT_EQ(counter, 6); +} |