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

Fix bug that prevented Executor::spin_some() from exiting. #472

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
17 changes: 12 additions & 5 deletions rclcpp/src/rclcpp/executor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,12 +206,19 @@ Executor::spin_some()
throw std::runtime_error("spin_some() called while already spinning");
}
RCLCPP_SCOPE_EXIT(this->spinning.store(false); );
while (spinning.load()) {
if (spinning.load()) {
AnyExecutable any_exec;
if (get_next_executable(any_exec, std::chrono::milliseconds::zero())) {
execute_any_executable(any_exec);
} else {
break;
vector<AnyExecutable> all_executables;

//Collect all of the executables that are pending.
//But don't execute them until the queue of actions
//is flushed out.
while ( get_next_executable(any_exec, std::chrono::milliseconds::zero())) {
all_executables.push_back ( any_exec );
}

for ( auto cur_exec : all_executables ) {
execute_any_executable( cur_exec );
}
}
}
Expand Down