diff --git a/rosbag2_transport/src/rosbag2_transport/rosbag2_transport.cpp b/rosbag2_transport/src/rosbag2_transport/rosbag2_transport.cpp index 43080bdd2c..753c9f6400 100644 --- a/rosbag2_transport/src/rosbag2_transport/rosbag2_transport.cpp +++ b/rosbag2_transport/src/rosbag2_transport/rosbag2_transport.cpp @@ -98,7 +98,11 @@ void Recorder::record( exec.add_node(recorder); auto spin_thread = std::thread( [&exec]() { - exec.spin(); + const auto time_step = std::chrono::milliseconds(1); + while (rclcpp::ok()) { + exec.spin_some(); + std::this_thread::sleep_for(time_step); + } }); auto exit = rcpputils::scope_exit( [&exec, &spin_thread]() {