From 3231bdce17fa5103afada47b0c8dc75feed56265 Mon Sep 17 00:00:00 2001 From: James Chen Date: Thu, 15 Aug 2024 18:47:00 +0800 Subject: [PATCH] Use std::this_thread::sleep_for --- native/tests/unit-test/src/scheduler_test.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/native/tests/unit-test/src/scheduler_test.cpp b/native/tests/unit-test/src/scheduler_test.cpp index ca85307fd5a..a0890b36403 100644 --- a/native/tests/unit-test/src/scheduler_test.cpp +++ b/native/tests/unit-test/src/scheduler_test.cpp @@ -22,6 +22,8 @@ THE SOFTWARE. ****************************************************************************/ #include +#include +#include #include "base/Scheduler.h" #include "utils.h" @@ -50,7 +52,7 @@ TEST(schedulerTest, performInCocosThreadOrder) { orderResult.emplace_back(12); }); - usleep(100 * 1000); + std::this_thread::sleep_for(std::chrono::milliseconds(100)); } }; scheduler->performFunctionInCocosThread(task);