aboutsummaryrefslogtreecommitdiff
path: root/src/armnn/test/ProfilerTests.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/armnn/test/ProfilerTests.cpp')
-rw-r--r--src/armnn/test/ProfilerTests.cpp19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/armnn/test/ProfilerTests.cpp b/src/armnn/test/ProfilerTests.cpp
index 8fd97179f1..b23ac1ccc3 100644
--- a/src/armnn/test/ProfilerTests.cpp
+++ b/src/armnn/test/ProfilerTests.cpp
@@ -7,6 +7,7 @@
#include <doctest/doctest.h>
+#include <algorithm>
#include <thread>
#include <Profiling.hpp>
@@ -90,15 +91,17 @@ TEST_CASE("RegisterUnregisterProfilerSingleThread")
TEST_CASE("RegisterUnregisterProfilerMultipleThreads")
{
bool res[3] = {false, false, false};
- std::thread thread1([&res]() { RegisterUnregisterProfilerSingleThreadImpl(res[0]); });
- std::thread thread2([&res]() { RegisterUnregisterProfilerSingleThreadImpl(res[1]); });
- std::thread thread3([&res]() { RegisterUnregisterProfilerSingleThreadImpl(res[2]); });
-
- thread1.join();
- thread2.join();
- thread3.join();
+ std::vector<std::thread> threads;
+ for (unsigned int i = 0; i < 3; ++i)
+ {
+ threads.push_back(std::thread([&res, i]() { RegisterUnregisterProfilerSingleThreadImpl(res[i]); }));
+ }
+ std::for_each(threads.begin(), threads.end(), [](std::thread& theThread)
+ {
+ theThread.join();
+ });
- for (int i = 0 ; i < 3 ; i++)
+ for (int i = 0 ; i < 3 ; ++i)
{
CHECK(res[i]);
}