From faf7e2139d2f426fc8833beb1dcdec12a031ca42 Mon Sep 17 00:00:00 2001 From: Sai Kishor Kothakota Date: Thu, 19 Dec 2024 11:29:17 +0100 Subject: [PATCH] Fix the lock_guard placement --- hardware_interface/src/resource_manager.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/hardware_interface/src/resource_manager.cpp b/hardware_interface/src/resource_manager.cpp index 06c56b4cce..487a6cacb5 100644 --- a/hardware_interface/src/resource_manager.cpp +++ b/hardware_interface/src/resource_manager.cpp @@ -685,8 +685,8 @@ void ResourceManager::load_urdf( const std::string actuator_type = "actuator"; const auto hardware_info = hardware_interface::parse_control_resources_from_urdf(urdf); + std::lock_guard resource_guard(resources_lock_); if (load_and_initialize_components) - std::lock_guard resource_guard(resources_lock_); { for (const auto & individual_hardware_info : hardware_info) { @@ -716,7 +716,6 @@ void ResourceManager::load_urdf( validate_storage(hardware_info); } - std::lock_guard guard(resources_lock_); read_write_status.failed_hardware_names.reserve( resource_storage_->actuators_.size() + resource_storage_->sensors_.size() + resource_storage_->systems_.size());