1616#define RCLCPP__EXECUTORS__EVENTS_EXECUTOR_HPP_
1717
1818#include < chrono>
19- #include < deque>
2019#include < memory>
20+ #include < queue>
2121#include < vector>
2222
2323#include " rclcpp/executor.hpp"
@@ -174,9 +174,7 @@ class EventsExecutor : public rclcpp::Executor
174174private:
175175 RCLCPP_DISABLE_COPY (EventsExecutor)
176176
177- // Event queue implementation is a deque only to
178- // facilitate the removal of events from expired entities.
179- using EventQueue = std::deque<rmw_listener_event_t >;
177+ using EventQueue = std::queue<rmw_listener_event_t >;
180178
181179 // Executor callback: Push new events into the queue and trigger cv.
182180 // This function is called by the DDS entities when an event happened,
@@ -192,7 +190,7 @@ class EventsExecutor : public rclcpp::Executor
192190 {
193191 std::unique_lock<std::mutex> lock (this_executor->push_mutex_ );
194192
195- this_executor->event_queue_ .push_back (event);
193+ this_executor->event_queue_ .push (event);
196194 }
197195 // Notify that the event queue has some events in it.
198196 this_executor->event_queue_cv_ .notify_one ();
@@ -208,12 +206,12 @@ class EventsExecutor : public rclcpp::Executor
208206 void
209207 execute_event (const rmw_listener_event_t & event);
210208
211- // We use two instances of EventQueue to allow threads to push events while we execute them
209+ // Queue where entities can push events
212210 EventQueue event_queue_;
213- EventQueue execution_event_queue_;
214211
215212 EventsExecutorEntitiesCollector::SharedPtr entities_collector_;
216213 EventsExecutorNotifyWaitable::SharedPtr executor_notifier_;
214+
217215 // Mutex to protect the insertion of events in the queue
218216 std::mutex push_mutex_;
219217 // Variable used to notify when an event is added to the queue
0 commit comments