Skip to content

Commit af313bc

Browse files
committed
Fix namespaces and includes for lock_free_events_queue
1 parent c4edd71 commit af313bc

File tree

2 files changed

+21
-9
lines changed

2 files changed

+21
-9
lines changed

rclcpp/include/rclcpp/experimental/executors/events_executor/lock_free_events_queue.hpp

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
1-
// Copyright 2022 iRobot Corporation. All Rights Reserved
1+
// Copyright 2022-2024 iRobot Corporation. All Rights Reserved
22

33
#ifndef RCLCPP__EXPERIMENTAL__EXECUTORS__EVENTS_EXECUTOR__LOCK_FREE_EVENTS_QUEUE_HPP_
44
#define RCLCPP__EXPERIMENTAL__EXECUTORS__EVENTS_EXECUTOR__LOCK_FREE_EVENTS_QUEUE_HPP_
55

6-
#include "concurrent_queue/blockingconcurrentqueue.h"
7-
#include "events_queue.hpp"
6+
#include "rclcpp/experimental/executors/events_executor/concurrent_queue/blockingconcurrentqueue.h"
7+
#include "rclcpp/experimental/executors/events_executor/events_queue.hpp"
8+
9+
namespace rclcpp
10+
{
11+
namespace experimental
12+
{
13+
namespace executors
14+
{
815

916
/**
1017
* @brief This class implements an EventsQueue as a simple wrapper around
@@ -17,7 +24,7 @@
1724
* queue aims to fix the issue of publishers being blocked by the executor extracting
1825
* events from the queue in a different thread, causing expensive mutex contention.
1926
*/
20-
class LockFreeEventsQueue : public rclcpp::experimental::executors::EventsQueue
27+
class LockFreeEventsQueue : public EventsQueue
2128
{
2229
public:
2330
RCLCPP_PUBLIC
@@ -26,7 +33,7 @@ class LockFreeEventsQueue : public rclcpp::experimental::executors::EventsQueue
2633
// It's important that all threads have finished using the queue
2734
// and the memory effects have fully propagated, before it is destructed.
2835
// Consume all events
29-
rclcpp::experimental::executors::ExecutorEvent event;
36+
ExecutorEvent event;
3037
while (event_queue_.try_dequeue(event)) {}
3138
}
3239

@@ -36,9 +43,9 @@ class LockFreeEventsQueue : public rclcpp::experimental::executors::EventsQueue
3643
*/
3744
RCLCPP_PUBLIC
3845
void
39-
enqueue(const rclcpp::experimental::executors::ExecutorEvent & event) override
46+
enqueue(const ExecutorEvent & event) override
4047
{
41-
rclcpp::experimental::executors::ExecutorEvent single_event = event;
48+
ExecutorEvent single_event = event;
4249
single_event.num_events = 1;
4350
for (size_t ev = 0; ev < event.num_events; ev++) {
4451
event_queue_.enqueue(single_event);
@@ -92,4 +99,9 @@ class LockFreeEventsQueue : public rclcpp::experimental::executors::EventsQueue
9299
moodycamel::BlockingConcurrentQueue<rclcpp::experimental::executors::ExecutorEvent> event_queue_;
93100
};
94101

102+
} // namespace executors
103+
} // namespace experimental
104+
} // namespace rclcpp
105+
106+
95107
#endif // RCLCPP__EXPERIMENTAL__EXECUTORS__EVENTS_EXECUTOR__LOCK_FREE_EVENTS_QUEUE_HPP_

rclcpp/test/rclcpp/test_reinitialized_timers.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#include <rclcpp/rclcpp.hpp>
66

77
#include "rclcpp/experimental/executors/events_executor/events_executor.hpp"
8-
#include "rclcpp/experimental/executors/events_executor/simple_events_queue.hpp"
8+
#include "rclcpp/experimental/executors/events_executor/lock_free_events_queue.hpp"
99

1010
using rclcpp::experimental::executors::EventsExecutor;
1111

@@ -28,7 +28,7 @@ TEST_F(TimersTest, TimersWithSamePeriod)
2828
{
2929
auto timers_period = std::chrono::milliseconds(50);
3030
auto node = std::make_shared<rclcpp::Node>("test_node");
31-
auto events_queue = std::make_unique<rclcpp::experimental::executors::SimpleEventsQueue>();
31+
auto events_queue = std::make_unique<rclcpp::experimental::executors::LockFreeEventsQueue>();
3232
auto executor = std::make_unique<EventsExecutor>(std::move(events_queue), true, rclcpp::ExecutorOptions());
3333

3434
executor->add_node(node);

0 commit comments

Comments
 (0)