From c4eb3a2b216994b9c0d934c7b3d50d111f6f12e8 Mon Sep 17 00:00:00 2001 From: li-yaoyao777 Date: Fri, 15 Nov 2024 11:35:51 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B4=E6=94=B9=E9=BB=84=E8=93=9D=E5=B7=AE?= =?UTF-8?q?=E5=BC=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: li-yaoyao777 --- frameworks/js/napi/src/sensor_napi_utils.cpp | 2 +- frameworks/native/src/sensor_service_client.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/frameworks/js/napi/src/sensor_napi_utils.cpp b/frameworks/js/napi/src/sensor_napi_utils.cpp index d909049d..0780de8a 100644 --- a/frameworks/js/napi/src/sensor_napi_utils.cpp +++ b/frameworks/js/napi/src/sensor_napi_utils.cpp @@ -322,7 +322,7 @@ bool ConvertToSensorData(const napi_env &env, sptr asyncCallb { CHKPF(asyncCallbackInfo); int32_t sensorTypeId = asyncCallbackInfo->data.sensorData.sensorTypeId; - std::lock_guard sensorAttrListMutex(g_sensorAttrListMutex); + std::lock_guard sensorAttrListLock(g_sensorAttrListMutex); CHKNCF(env, (g_sensorAttributeList.find(sensorTypeId) != g_sensorAttributeList.end()), "Invalid sensor type"); if (sensorTypeId == SENSOR_TYPE_ID_WEAR_DETECTION && asyncCallbackInfo->type == SUBSCRIBE_CALLBACK) { return ConvertToBodyData(env, asyncCallbackInfo, result); diff --git a/frameworks/native/src/sensor_service_client.cpp b/frameworks/native/src/sensor_service_client.cpp index 2df12cd3..1df5ead9 100644 --- a/frameworks/native/src/sensor_service_client.cpp +++ b/frameworks/native/src/sensor_service_client.cpp @@ -223,7 +223,7 @@ void SensorServiceClient::ReenableSensor() CALL_LOG_ENTER; std::lock_guard mapLock(mapMutex_); for (const auto &it : sensorInfoMap_) { - std::lock_guard clientLock_(clientMutex_); + std::lock_guard clientLock(clientMutex_); if (sensorServer_ != nullptr) { sensorServer_->EnableSensor(it.first, it.second.GetSamplingPeriodNs(), it.second.GetMaxReportDelayNs()); } @@ -265,7 +265,7 @@ void SensorServiceClient::ProcessDeathObserver(const wptr &object SENSOR_AGENT_IMPL->SetIsChannelCreated(false); return; } - std::lock_guard clientLock_(clientMutex_); + std::lock_guard clientLock(clientMutex_); if (sensorServer_ != nullptr && sensorClientStub_ != nullptr) { auto remoteObject = sensorClientStub_->AsObject(); if (remoteObject != nullptr) {