Skip to content

Commit 4a2579f

Browse files
committed
lock before rcl_set_ros_time_override
Signed-off-by: Daisuke Sato <daisukes@cmu.edu>
1 parent bbf2c4c commit 4a2579f

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

rclcpp/src/rclcpp/time_source.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ void TimeSource::set_clock(
192192
enable_ros_time(clock);
193193
}
194194

195+
std::lock_guard<std::mutex> clock_guard(clock->get_clock_mutex());
195196
auto ret = rcl_set_ros_time_override(clock->get_clock_handle(), rclcpp::Time(*msg).nanoseconds());
196197
if (ret != RCL_RET_OK) {
197198
rclcpp::exceptions::throw_from_rcl_error(

0 commit comments

Comments
 (0)