Skip to content

Commit

Permalink
Make sure to check rclcpp::ok while looping
Browse files Browse the repository at this point in the history
Signed-off-by: Emerson Knapp <[email protected]>
  • Loading branch information
Emerson Knapp committed Apr 2, 2021
1 parent bb59ff7 commit 20f37f3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion rosbag2_transport/src/rosbag2_transport/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ void Player::play_messages_until_queue_empty()
while (message_queue_.try_dequeue(message) && rclcpp::ok()) {
// Do not move on until sleep_until returns true
// It will always sleep, so this is not a tight busy loop on pause
while (!clock_->sleep_until(message->time_stamp)) {}
while (rclcpp::ok() && !clock_->sleep_until(message->time_stamp)) {}
if (rclcpp::ok()) {
auto publisher_iter = publishers_.find(message->topic_name);
if (publisher_iter != publishers_.end()) {
Expand Down

0 comments on commit 20f37f3

Please sign in to comment.