From adbeefa587d6e96bc1674b02ee163746cee10fee Mon Sep 17 00:00:00 2001 From: shenpeixing Date: Fri, 24 Jan 2025 11:46:22 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9foundation-SYS=5FFREEZE?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: shenpeixing --- frameworks/native/src/sensor_service_client.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/frameworks/native/src/sensor_service_client.cpp b/frameworks/native/src/sensor_service_client.cpp index de500da8..0a956f50 100644 --- a/frameworks/native/src/sensor_service_client.cpp +++ b/frameworks/native/src/sensor_service_client.cpp @@ -244,11 +244,13 @@ int32_t SensorServiceClient::DestroyDataChannel() void SensorServiceClient::ReenableSensor() { CALL_LOG_ENTER; - std::lock_guard mapLock(mapMutex_); - for (const auto &it : sensorInfoMap_) { + { std::lock_guard clientLock(clientMutex_); - if (sensorServer_ != nullptr) { - sensorServer_->EnableSensor(it.first, it.second.GetSamplingPeriodNs(), it.second.GetMaxReportDelayNs()); + std::lock_guard mapLock(mapMutex_); + for (const auto &it : sensorInfoMap_) { + if (sensorServer_ != nullptr) { + sensorServer_->EnableSensor(it.first, it.second.GetSamplingPeriodNs(), it.second.GetMaxReportDelayNs()); + } } } if (!isConnected_) { -- Gitee