Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DRAFT: Fix: Double spin required since 28.2.0 #2595

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
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
21 changes: 21 additions & 0 deletions rclcpp/src/rclcpp/executor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -726,6 +726,27 @@ Executor::wait_for_work(std::chrono::nanoseconds timeout)
{
TRACETOOLS_TRACEPOINT(rclcpp_executor_wait_for_work, timeout.count());

// query, if notify_waitable_ was triggered by a guard condition
// make sure that it is executed before the wait, as this enforces
// a collection rebuild before the wait.
{
// the real one has been added to the main waitset, therefore we need to create a copy
executors::ExecutorNotifyWaitable::SharedPtr notify_cpy = std::make_shared<executors::ExecutorNotifyWaitable>(*notify_waitable_);

rclcpp::WaitSet notify_only_wait_set_({}, {}, {}, {}, {}, {}, context_);
notify_only_wait_set_.add_waitable(notify_cpy);
auto res = notify_only_wait_set_.wait(std::chrono::nanoseconds(0));
if(res.kind() == WaitResultKind::Ready) {
auto & rcl_wait_set = res.get_wait_set().get_rcl_wait_set();
if (notify_cpy->is_ready(rcl_wait_set)) {
notify_cpy->execute(notify_cpy->take_data());

// make sure we don't loos a wakeup
jmachowinski marked this conversation as resolved.
Show resolved Hide resolved
interrupt_guard_condition_->trigger();
}
}
}

// Clear any previous wait result
this->wait_result_.reset();

Expand Down