From b8b16b1cb839603f4a02cb9de84c333f5d2d0935 Mon Sep 17 00:00:00 2001 From: facetosea <25808407@qq.com> Date: Wed, 15 May 2024 22:24:08 +0800 Subject: [PATCH] fix test case on windows --- source/os/test/osSemaphoreTests.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/source/os/test/osSemaphoreTests.cpp b/source/os/test/osSemaphoreTests.cpp index 30f2c497d7..09fbe27f55 100644 --- a/source/os/test/osSemaphoreTests.cpp +++ b/source/os/test/osSemaphoreTests.cpp @@ -111,7 +111,7 @@ TEST(osSemaphoreTests, Performance1_1) { const int count = 100000; tsem_init(&sem, 0, 0); - std::thread([&sem]() { + std::thread([&sem, count]() { for (int i = 0; i < count; ++i) { tsem_post(&sem); } @@ -128,7 +128,7 @@ TEST(osSemaphoreTests, Performance1_2) { const int count = 100000; tsem2_init(&sem, 0, 0); - std::thread([&sem]() { + std::thread([&sem, count]() { for (int i = 0; i < count; ++i) { tsem2_post(&sem); } @@ -145,13 +145,13 @@ TEST(osSemaphoreTests, Performance2_1) { const int count = 50000; tsem_init(&sem, 0, 0); - std::thread([&sem]() { + std::thread([&sem, count]() { for (int i = 0; i < count; ++i) { tsem_post(&sem); } }).detach(); - std::thread([&sem]() { + std::thread([&sem, count]() { for (int i = 0; i < count; ++i) { tsem_post(&sem); } @@ -168,13 +168,13 @@ TEST(osSemaphoreTests, Performance2_2) { const int count = 50000; tsem2_init(&sem, 0, 0); - std::thread([&sem]() { + std::thread([&sem, count]() { for (int i = 0; i < count; ++i) { tsem2_post(&sem); } }).detach(); - std::thread([&sem]() { + std::thread([&sem, count]() { for (int i = 0; i < count; ++i) { tsem2_post(&sem); } @@ -213,7 +213,7 @@ TEST(osSemaphoreTests, Performance4_1) { for (int i = 0; i < count; ++i) { tsem_t sem; tsem_init(&sem, 0, 0); - std::thread([&sem]() { + std::thread([&sem, count]() { tsem_post(&sem); }).detach(); @@ -228,7 +228,7 @@ TEST(osSemaphoreTests, Performance4_2) { for (int i = 0; i < count; ++i) { tsem2_t sem; tsem2_init(&sem, 0, 0); - std::thread([&sem]() { + std::thread([&sem, count]() { tsem2_post(&sem); }).detach();