From de9782f8351ae8cc88901c08e565fe9df48d72b9 Mon Sep 17 00:00:00 2001 From: Michael Orlov Date: Thu, 26 Dec 2024 12:35:11 -0800 Subject: [PATCH] Bugfix. Event publisher not starting for second run after stop Signed-off-by: Michael Orlov --- rosbag2_transport/src/rosbag2_transport/recorder.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/rosbag2_transport/src/rosbag2_transport/recorder.cpp b/rosbag2_transport/src/rosbag2_transport/recorder.cpp index d5d1f0b0e..62a69732b 100644 --- a/rosbag2_transport/src/rosbag2_transport/recorder.cpp +++ b/rosbag2_transport/src/rosbag2_transport/recorder.cpp @@ -328,7 +328,11 @@ void RecorderImpl::record() node->create_publisher("events/write_split", 1); // Start the thread that will publish events - event_publisher_thread_ = std::thread(&RecorderImpl::event_publisher_thread_main, this); + { + std::lock_guard lock(event_publisher_thread_mutex_); + event_publisher_thread_should_exit_ = false; + event_publisher_thread_ = std::thread(&RecorderImpl::event_publisher_thread_main, this); + } rosbag2_cpp::bag_events::WriterEventCallbacks callbacks; callbacks.write_split_callback =