Skip to content

Commit d1d940e

Browse files
author
Mauro Passerino
committed
rename local_event_queue->execution_event_queue
1 parent 2828376 commit d1d940e

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

rclcpp/include/rclcpp/executors/events_executor.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -223,12 +223,12 @@ class EventsExecutor : public rclcpp::Executor
223223
// Remove events associated with this entity from the local event queue
224224
{
225225
std::unique_lock<std::mutex> lock(execution_mutex_);
226-
local_event_queue_.erase(
226+
execution_event_queue_.erase(
227227
std::remove_if(
228-
local_event_queue_.begin(), local_event_queue_.end(),
228+
execution_event_queue_.begin(), execution_event_queue_.end(),
229229
[&entity](ExecutorEvent event) {
230230
return event.entity == entity;
231-
}), local_event_queue_.end());
231+
}), execution_event_queue_.end());
232232
}
233233
}
234234

@@ -244,7 +244,7 @@ class EventsExecutor : public rclcpp::Executor
244244

245245
// We use two instances of EventQueue to allow threads to push events while we execute them
246246
EventQueue event_queue_;
247-
EventQueue local_event_queue_;
247+
EventQueue execution_event_queue_;
248248

249249
EventsExecutorEntitiesCollector::SharedPtr entities_collector_;
250250
EventsExecutorNotifyWaitable::SharedPtr executor_notifier_;

rclcpp/src/rclcpp/executors/events_executor.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,11 @@ EventsExecutor::spin()
6767
event_queue_cv_.wait(push_lock, has_event_predicate);
6868
std::unique_lock<std::mutex> execution_lock(execution_mutex_);
6969
// We got an event! Swap queues while we hold both mutexes
70-
std::swap(local_event_queue_, event_queue_);
70+
std::swap(execution_event_queue_, event_queue_);
7171
// After swapping the queues, we don't need the push lock anymore
7272
push_lock.unlock();
7373
// Consume events while under the execution lock only
74-
this->consume_all_events(local_event_queue_);
74+
this->consume_all_events(execution_event_queue_);
7575
}
7676
timers_manager_->stop();
7777
}
@@ -108,9 +108,9 @@ EventsExecutor::spin_some(std::chrono::nanoseconds max_duration)
108108
std::unique_lock<std::mutex> push_lock(push_mutex_);
109109
event_queue_cv_.wait_for(push_lock, max_duration, has_event_predicate);
110110
std::unique_lock<std::mutex> execution_lock(execution_mutex_);
111-
std::swap(local_event_queue_, event_queue_);
111+
std::swap(execution_event_queue_, event_queue_);
112112
push_lock.unlock();
113-
this->consume_all_events(local_event_queue_);
113+
this->consume_all_events(execution_event_queue_);
114114
execution_lock.unlock();
115115

116116
timers_manager_->execute_ready_timers();
@@ -154,18 +154,18 @@ EventsExecutor::spin_all(std::chrono::nanoseconds max_duration)
154154
while (rclcpp::ok(context_) && spinning.load() && max_duration_not_elapsed()) {
155155
std::unique_lock<std::mutex> push_lock(push_mutex_);
156156
std::unique_lock<std::mutex> execution_lock(execution_mutex_);
157-
std::swap(local_event_queue_, event_queue_);
157+
std::swap(execution_event_queue_, event_queue_);
158158
push_lock.unlock();
159159

160160
bool ready_timer = timers_manager_->get_head_timeout() < 0ns;
161-
bool has_events = !local_event_queue_.empty();
161+
bool has_events = !execution_event_queue_.empty();
162162
if (!ready_timer && !has_events) {
163163
// Exit as there is no more work to do
164164
break;
165165
}
166166
// Execute all ready work
167167

168-
this->consume_all_events(local_event_queue_);
168+
this->consume_all_events(execution_event_queue_);
169169
execution_lock.unlock();
170170

171171
timers_manager_->execute_ready_timers();

0 commit comments

Comments
 (0)