Signed-off-by: zhanglei <zhanglei730@huawei.com>
This commit is contained in:
zhanglei 2024-06-06 09:29:35 +08:00
parent 8c0648660a
commit b45551871e
7 changed files with 118 additions and 0 deletions

79
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,79 @@
{
"files.associations": {
"xstring": "cpp",
"algorithm": "cpp",
"atomic": "cpp",
"bit": "cpp",
"bitset": "cpp",
"cctype": "cpp",
"charconv": "cpp",
"chrono": "cpp",
"cinttypes": "cpp",
"clocale": "cpp",
"cmath": "cpp",
"codecvt": "cpp",
"compare": "cpp",
"concepts": "cpp",
"condition_variable": "cpp",
"cstddef": "cpp",
"cstdint": "cpp",
"cstdio": "cpp",
"cstdlib": "cpp",
"cstring": "cpp",
"ctime": "cpp",
"cwchar": "cpp",
"exception": "cpp",
"format": "cpp",
"forward_list": "cpp",
"fstream": "cpp",
"functional": "cpp",
"initializer_list": "cpp",
"iomanip": "cpp",
"ios": "cpp",
"iosfwd": "cpp",
"iostream": "cpp",
"istream": "cpp",
"iterator": "cpp",
"limits": "cpp",
"list": "cpp",
"locale": "cpp",
"map": "cpp",
"memory": "cpp",
"mutex": "cpp",
"new": "cpp",
"optional": "cpp",
"ostream": "cpp",
"ratio": "cpp",
"regex": "cpp",
"set": "cpp",
"shared_mutex": "cpp",
"sstream": "cpp",
"stdexcept": "cpp",
"stop_token": "cpp",
"streambuf": "cpp",
"string": "cpp",
"system_error": "cpp",
"thread": "cpp",
"tuple": "cpp",
"type_traits": "cpp",
"typeinfo": "cpp",
"unordered_map": "cpp",
"unordered_set": "cpp",
"utility": "cpp",
"vector": "cpp",
"xfacet": "cpp",
"xhash": "cpp",
"xiosbase": "cpp",
"xlocale": "cpp",
"xlocbuf": "cpp",
"xlocinfo": "cpp",
"xlocmes": "cpp",
"xlocmon": "cpp",
"xlocnum": "cpp",
"xloctime": "cpp",
"xmemory": "cpp",
"xtr1common": "cpp",
"xtree": "cpp",
"xutility": "cpp"
}
}

View File

@ -269,6 +269,10 @@ int32_t DistributedDeviceProfileService::OnIdle(const SystemAbilityOnDemandReaso
void DistributedDeviceProfileService::OnStop()
{
HILOGI("called");
if (!DistributedDeviceProfile::DistributedDeviceProfileServiceNew::GetInstance().UnInit()) {
HILOGE("UnInit failed");
return;
}
}
bool DistributedDeviceProfileService::DoInit()

View File

@ -7,6 +7,7 @@
"run-on-create": false,
"distributed": true,
"dump-level": 1,
"recycle-strategy": "low-memory",
"start-on-demand": {
"deviceonline": [
{

View File

@ -166,6 +166,7 @@ int32_t DistributedDeviceProfileServiceNew::UnInit()
HILOGE("EventHandlerFactory UnInit failed");
return DP_CACHE_UNINIT_FAIL;
}
DestroyUnloadHandler();
HILOGI("init succeeded");
return DP_SUCCESS;
}

View File

@ -63,6 +63,10 @@ int32_t PermissionManager::Init()
int32_t PermissionManager::UnInit()
{
HILOGI("UnInit");
{
std::lock_guard<std::mutex> lockGuard(permissionMutex_);
permissionMap_.clear();
}
return DP_SUCCESS;
}

View File

@ -44,6 +44,11 @@ int32_t SubscribeProfileManager::Init()
int32_t SubscribeProfileManager::UnInit()
{
HILOGI("call!");
{
std::lock_guard<std::mutex> lockGuard(subscribeMutex_);
subscribeInfoMap_.clear();
}
funcsMap_.clear();
return DP_SUCCESS;
}

View File

@ -65,6 +65,30 @@ int32_t ProfileCache::Init()
int32_t ProfileCache::UnInit()
{
HILOGI("UnInit");
{
std::lock_guard<std::mutex> lock(onlineDeviceLock_);
onlineDevMap_.clear();
}
{
std::lock_guard<std::mutex> lock(deviceProfileMutex_);
deviceProfileMap_.clear();
}
{
std::lock_guard<std::mutex> lock(serviceProfileMutex_);
serviceProfileMap_.clear();
}
{
std::lock_guard<std::mutex> lock(charProfileMutex_);
charProfileMap_.clear();
}
{
std::lock_guard<std::mutex> lock(staticCharProfileMutex_);
staticCharProfileMap_.clear();
}
{
std::lock_guard<std::mutex> lock(syncListenerMutex_);
syncListenerMap_.clear();
}
return DP_SUCCESS;
}