diff options
author | jacobkeeler <jacob.keeler@livioradio.com> | 2019-03-05 09:57:14 -0500 |
---|---|---|
committer | jacobkeeler <jacob.keeler@livioradio.com> | 2019-03-05 09:57:14 -0500 |
commit | c2f835cffa63fe1c5ac37c28a8c3e89acb30e086 (patch) | |
tree | 9644450a8714afc3fbb3f40f7632e62cd1e94c67 /src | |
parent | 090ebab24ddb3c761386f20e873b0142fb42db51 (diff) | |
download | sdl_core-c2f835cffa63fe1c5ac37c28a8c3e89acb30e086.tar.gz |
Fix lock usage
Diffstat (limited to 'src')
-rw-r--r-- | src/components/application_manager/src/app_service_manager.cc | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/components/application_manager/src/app_service_manager.cc b/src/components/application_manager/src/app_service_manager.cc index 73219df456..dcdcd0e66f 100644 --- a/src/components/application_manager/src/app_service_manager.cc +++ b/src/components/application_manager/src/app_service_manager.cc @@ -76,7 +76,6 @@ smart_objects::SmartObject AppServiceManager::PublishAppService( std::to_string(std::rand()); service_id = encryption::MakeHash(str_to_hash); } while (published_services_.find(service_id) != published_services_.end()); - published_services_lock_.Release(); AppService app_service; app_service.connection_key = connection_key; @@ -106,11 +105,11 @@ smart_objects::SmartObject AppServiceManager::PublishAppService( } app_service.default_service = GetPolicyAppID(app_service) == default_app_id; - { - sync_primitives::AutoLock lock(published_services_lock_); - published_services_.insert( - std::pair<std::string, AppService>(service_id, app_service)); - } + auto ret = published_services_.insert( + std::pair<std::string, AppService>(service_id, app_service)); + smart_objects::SmartObject& published_record = ret.first->second.record; + published_services_lock_.Release(); + smart_objects::SmartObject msg_params; msg_params[strings::system_capability][strings::system_capability_type] = mobile_apis::SystemCapabilityType::APP_SERVICES; @@ -126,7 +125,7 @@ smart_objects::SmartObject AppServiceManager::PublishAppService( ActivateAppService(service_id); } - return service_record; + return published_record; } bool AppServiceManager::UnpublishAppService(const std::string service_id) { |