From 2945efcc5b7be15f44a9d71b4c6904af4fb25ccb Mon Sep 17 00:00:00 2001 From: wangkun Date: Thu, 22 Jul 2021 23:09:13 +0800 Subject: [PATCH 1/3] fixed the distributeddata deadlock bugs Signed-off-by: wangkun --- .../communicator/src/softbus_adapter_standard.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/services/distributeddataservice/adapter/communicator/src/softbus_adapter_standard.cpp b/services/distributeddataservice/adapter/communicator/src/softbus_adapter_standard.cpp index 78c365e65..449b490d1 100755 --- a/services/distributeddataservice/adapter/communicator/src/softbus_adapter_standard.cpp +++ b/services/distributeddataservice/adapter/communicator/src/softbus_adapter_standard.cpp @@ -201,12 +201,18 @@ Status SoftBusAdapter::StopWatchDeviceChange(const AppDeviceStatusChangeListener void SoftBusAdapter::NotifyAll(const DeviceInfo &deviceInfo, const DeviceChangeType &type) { std::thread th = std::thread([this, deviceInfo, type]() { - std::lock_guard lock(deviceChangeMutex_); + std::vector listeners; + { + std::lock_guard lock(deviceChangeMutex_); + for (const auto &listener : listeners_) { + listeners.push_back(listener); + } + } ZLOGD("high"); std::string uuid = GetUuidByNodeId(deviceInfo.deviceId); ZLOGD("[Notify] to DB from: %{public}s, type:%{public}d", ToBeAnonymous(uuid).c_str(), type); UpdateRelationship(deviceInfo.deviceId, type); - for (const auto &device : listeners_) { + for (const auto &device : listeners) { if (device == nullptr) { continue; } @@ -217,7 +223,7 @@ void SoftBusAdapter::NotifyAll(const DeviceInfo &deviceInfo, const DeviceChangeT } } ZLOGD("low"); - for (const auto &device : listeners_) { + for (const auto &device : listeners) { if (device == nullptr) { continue; } @@ -228,7 +234,7 @@ void SoftBusAdapter::NotifyAll(const DeviceInfo &deviceInfo, const DeviceChangeT } } ZLOGD("min"); - for (const auto &device : listeners_) { + for (const auto &device : listeners) { if (device == nullptr) { continue; } -- Gitee From a2a76096fd094022b9f3dac5c2d34d476fafddd8 Mon Sep 17 00:00:00 2001 From: wbq_sky Date: Tue, 27 Jul 2021 16:28:59 +0800 Subject: [PATCH 2/3] remote the unused code Signed-off-by: wbq_sky --- .../distributeddb/include/distributeddb_schema_test_tools.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/services/distributeddataservice/test/common/distributeddb/include/distributeddb_schema_test_tools.h b/services/distributeddataservice/test/common/distributeddb/include/distributeddb_schema_test_tools.h index 7faa44956..d70191032 100755 --- a/services/distributeddataservice/test/common/distributeddb/include/distributeddb_schema_test_tools.h +++ b/services/distributeddataservice/test/common/distributeddb/include/distributeddb_schema_test_tools.h @@ -15,9 +15,7 @@ #ifndef DISTRIBUTED_DB_SCHEMA_TEST_TOOLS_H #define DISTRIBUTED_DB_SCHEMA_TEST_TOOLS_H -#ifdef RUNNING_ON_SIMULATED_ENV #include -#endif #include "kv_store_delegate.h" #include "kv_store_delegate_manager.h" #include "types.h" @@ -182,4 +180,4 @@ public: const uint64_t serialNo, const RecordInfo &recordInfo, const std::string &valueSkipString = VALUE_SKIP_STRING); }; -#endif // DISTRIBUTED_DB_SCHEMA_TEST_TOOLS_H \ No newline at end of file +#endif // DISTRIBUTED_DB_SCHEMA_TEST_TOOLS_H -- Gitee From 8ae1b47fb32473d4136c31a492de359ab46393c5 Mon Sep 17 00:00:00 2001 From: chensi10 Date: Tue, 27 Jul 2021 21:18:19 +0800 Subject: [PATCH 3/3] change for ces re-folder Signed-off-by: chensi10 --- services/distributeddataservice/adapter/account/BUILD.gn | 2 +- services/distributeddataservice/adapter/broadcaster/BUILD.gn | 2 +- services/distributeddataservice/app/src/uninstaller/BUILD.gn | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/services/distributeddataservice/adapter/account/BUILD.gn b/services/distributeddataservice/adapter/account/BUILD.gn index 67d8637c3..0a488ab98 100755 --- a/services/distributeddataservice/adapter/account/BUILD.gn +++ b/services/distributeddataservice/adapter/account/BUILD.gn @@ -40,9 +40,9 @@ ohos_static_library("distributeddata_account_static") { # "ces:libcommonevent", "aafwk_standard:want", + "ces_standard:cesfwk_innerkits", "hiviewdfx_hilog_native:libhilog", "ipc:ipc_core", "os_account_standard:libaccountkits", - "ces_standard:cesfwk_kits", ] } diff --git a/services/distributeddataservice/adapter/broadcaster/BUILD.gn b/services/distributeddataservice/adapter/broadcaster/BUILD.gn index 714a88514..c9ea199fd 100755 --- a/services/distributeddataservice/adapter/broadcaster/BUILD.gn +++ b/services/distributeddataservice/adapter/broadcaster/BUILD.gn @@ -33,9 +33,9 @@ ohos_static_library("distributeddata_broadcaster_static") { external_deps = [ # "ces:libcommonevent", "aafwk_standard:want", + "ces_standard:cesfwk_innerkits", "appexecfwk_standard:appexecfwk_base", "hiviewdfx_hilog_native:libhilog", "ipc:ipc_core", - "ces_standard:cesfwk_kits", ] } diff --git a/services/distributeddataservice/app/src/uninstaller/BUILD.gn b/services/distributeddataservice/app/src/uninstaller/BUILD.gn index 41d8af813..4194572e3 100755 --- a/services/distributeddataservice/app/src/uninstaller/BUILD.gn +++ b/services/distributeddataservice/app/src/uninstaller/BUILD.gn @@ -43,11 +43,11 @@ ohos_static_library("distributeddata_uninstaller_static") { # "ces:libcommonevent", "aafwk_standard:want", + "ces_standard:cesfwk_innerkits", "hiviewdfx_hilog_native:libhilog", "ipc:ipc_core", "safwk:system_ability_fwk", "samgr_L2:samgr_proxy", - "ces_standard:cesfwk_kits", "dmsfwk_standard:zuri" ] } -- Gitee