From c2ba1e9a5555a0f63afcea98a5c9110609367700 Mon Sep 17 00:00:00 2001 From: blc Date: Sat, 16 Aug 2025 16:18:34 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=9A=E7=BA=BF=E7=A8=8B=E7=94=A8=E4=BE=8B?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: blc --- test/unittest/cpp_test/src/input_method_ability_test.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/unittest/cpp_test/src/input_method_ability_test.cpp b/test/unittest/cpp_test/src/input_method_ability_test.cpp index 44d245753..62c4a6924 100644 --- a/test/unittest/cpp_test/src/input_method_ability_test.cpp +++ b/test/unittest/cpp_test/src/input_method_ability_test.cpp @@ -75,7 +75,7 @@ public: static constexpr int MAXRUNCOUNT = 100; static constexpr int THREAD_NUM = 5; static void TestOnConnectSystemCmd(); - static int32_t multiThreadExecTotalNum_; + static std::atomic multiThreadExecTotalNum_; class InputMethodEngineListenerImpl : public InputMethodEngineListener { public: @@ -294,7 +294,7 @@ uint64_t InputMethodAbilityTest::currentImeTokenId_ = 0; int32_t InputMethodAbilityTest::currentImeUid_ = 0; sptr InputMethodAbilityTest::imsa_; sptr InputMethodAbilityTest::imsaProxy_; -int32_t InputMethodAbilityTest::multiThreadExecTotalNum_{ 0 }; +std::atomic InputMethodAbilityTest::multiThreadExecTotalNum_{ 0 }; void InputMethodAbilityTest::TestOnConnectSystemCmd() { @@ -2226,10 +2226,10 @@ HWTEST_F(InputMethodAbilityTest, TestServiceHandler_, TestSize.Level0) HWTEST_F(InputMethodAbilityTest, TestOnConnectSystemCmd_001, TestSize.Level0) { IMSA_HILOGI("TestOnConnectSystemCmd_001 start."); - multiThreadExecTotalNum_ = 0; + multiThreadExecTotalNum_.store(0); SET_THREAD_NUM(THREAD_NUM); GTEST_RUN_TASK(TestOnConnectSystemCmd); - EXPECT_EQ(multiThreadExecTotalNum_, THREAD_NUM * MAXRUNCOUNT); + EXPECT_EQ(multiThreadExecTotalNum_.load(), THREAD_NUM * MAXRUNCOUNT); } /** -- Gitee