Skip to content

Commit

Permalink
Fix timer (see ros2#1692)
Browse files Browse the repository at this point in the history
  • Loading branch information
timonegk committed Jun 8, 2022
1 parent db7dbfe commit 64cbfd1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion rclcpp/src/rclcpp/executors/events_executor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ EventsExecutor::EventsExecutor(
entities_collector_ = std::make_shared<EventsExecutorEntitiesCollector>(this);
entities_collector_->init();

// Setup the executor notifier to wake up the executor when some guard conditions are tiggered.
// Set up the executor notifier to wake up the executor when some guard conditions are triggered.
// The added guard conditions are guaranteed to not go out of scope before the executor itself.
executor_notifier_ = std::make_shared<EventsExecutorNotifyWaitable>();
executor_notifier_->add_guard_condition(shutdown_guard_condition_.get());
Expand Down
2 changes: 2 additions & 0 deletions rclcpp/src/rclcpp/executors/timers_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ bool TimersManager::execute_head_timer()
const bool timer_ready = head_timer->is_ready();
if (timer_ready) {
// Invoke the timer callback
head_timer->call();
head_timer->execute_callback();
timers_heap.heapify_root();
weak_timers_heap_.store(timers_heap);
Expand Down Expand Up @@ -195,6 +196,7 @@ void TimersManager::execute_ready_timers_unsafe()
size_t executed_timers = 0;
while (executed_timers < number_ready_timers && head_timer->is_ready()) {
// Execute head timer
head_timer->call();
head_timer->execute_callback();
executed_timers++;
// Executing a timer will result in updating its time_until_trigger, so re-heapify
Expand Down

0 comments on commit 64cbfd1

Please sign in to comment.