Skip to content

Commit

Permalink
Fix the lock_guard placement (#1960)
Browse files Browse the repository at this point in the history
  • Loading branch information
saikishor authored Dec 20, 2024
1 parent 6a8053e commit 5c5a171
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions hardware_interface/src/resource_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::recursive_mutex> resource_guard(resources_lock_);
if (load_and_initialize_components)
std::lock_guard<std::recursive_mutex> resource_guard(resources_lock_);
{
for (const auto & individual_hardware_info : hardware_info)
{
Expand Down Expand Up @@ -716,7 +716,6 @@ void ResourceManager::load_urdf(
validate_storage(hardware_info);
}

std::lock_guard<std::recursive_mutex> guard(resources_lock_);
read_write_status.failed_hardware_names.reserve(
resource_storage_->actuators_.size() + resource_storage_->sensors_.size() +
resource_storage_->systems_.size());
Expand Down

0 comments on commit 5c5a171

Please sign in to comment.