diff --git a/frameworks/js/napi/src/sensor_napi_utils.cpp b/frameworks/js/napi/src/sensor_napi_utils.cpp index d909049d24c55efb66e58bb47695aae87c9517a5..0780de8adeec7f3d00af6cba0bca0bf97f96768a 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 2df12cd31b53e77f8f27fb5b68e9de0653b84852..1df5ead9c5fb8d1476a6f1a3b6c11095f2ff575b 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) {