From f153cf7173dc2b6bac1f856e52d9813b209c3757 Mon Sep 17 00:00:00 2001 From: Todd Malsbary Date: Fri, 30 Aug 2019 10:38:51 -0700 Subject: [PATCH] Fix hang with timers in MultiThreadedExecutor (#835) (#836) Signed-off-by: Todd Malsbary --- rclcpp/src/rclcpp/executors/multi_threaded_executor.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/rclcpp/src/rclcpp/executors/multi_threaded_executor.cpp b/rclcpp/src/rclcpp/executors/multi_threaded_executor.cpp index cc34d09..e2f878a 100644 --- a/rclcpp/src/rclcpp/executors/multi_threaded_executor.cpp +++ b/rclcpp/src/rclcpp/executors/multi_threaded_executor.cpp @@ -86,6 +86,11 @@ MultiThreadedExecutor::run(size_t) if (any_exec.timer) { // Guard against multiple threads getting the same timer. if (scheduled_timers_.count(any_exec.timer) != 0) { + // Make sure that any_exec's callback group is reset before + // the lock is released. + if (any_exec.callback_group) { + any_exec.callback_group->can_be_taken_from().store(true); + } continue; } scheduled_timers_.insert(any_exec.timer);