Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion example/test/example_test_gtest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ TEST_F(ExampleTest, check_parameters) {
}

TEST_F(ExampleTest, try_get_params) {
ASSERT_TRUE(param_listener_->try_get_params(params_));
ASSERT_FALSE(param_listener_->try_get_params(params_));

const rclcpp ::Parameter new_param("interpolation_mode", "linear");
example_test_node_->set_parameter(new_param);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,12 @@ struct StackParams {
}

bool try_get_params(Params & params_in) const {
if (mutex_.try_lock()) {
std::unique_lock<std::mutex> lock(mutex_, std::try_to_lock);
if (lock.owns_lock()) {
if (const bool is_old = params_in.__stamp != params_.__stamp; is_old) {
params_in = params_;
return true;
}
mutex_.unlock();
return true;
}
return false;
}
Expand Down
Loading