Skip to content

Commit 00e4a17

Browse files
author
Mauro Passerino
committed
Add num_events arg
Signed-off-by: Mauro Passerino <[email protected]>
1 parent e51dab0 commit 00e4a17

File tree

3 files changed

+7
-10
lines changed

3 files changed

+7
-10
lines changed

rclcpp/include/rclcpp/executors/events_executor.hpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ class EventsExecutor : public rclcpp::Executor
215215
// This function is called by the DDS entities when an event happened,
216216
// like a subscription receiving a message.
217217
static void
218-
push_event(const void * event_data)
218+
push_event(const void * event_data, size_t num_events)
219219
{
220220
if (!event_data) {
221221
throw std::runtime_error("Executor event data not valid.");
@@ -228,7 +228,9 @@ class EventsExecutor : public rclcpp::Executor
228228
// Event queue mutex scope
229229
{
230230
std::unique_lock<std::mutex> lock(this_executor->push_mutex_);
231-
this_executor->events_queue_->push(data->event);
231+
for (size_t i = 0; i < num_events; i++) {
232+
this_executor->events_queue_->push(data->event);
233+
}
232234
}
233235
// Notify that the event queue has some events in it.
234236
this_executor->events_queue_cv_.notify_one();

rclcpp/include/rclcpp/executors/events_executor_notify_waitable.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,7 @@ class EventsExecutorNotifyWaitable final : public EventWaitable
6868
rcl_ret_t ret = rcl_guard_condition_set_listener_callback(
6969
gc,
7070
callback,
71-
user_data,
72-
false);
71+
user_data);
7372

7473
if (RCL_RET_OK != ret) {
7574
throw std::runtime_error("Couldn't set guard condition events callback");

rclcpp/src/rclcpp/executors/events_executor_entities_collector.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -490,8 +490,7 @@ EventsExecutorEntitiesCollector::set_guard_condition_callback(
490490
rcl_ret_t ret = rcl_guard_condition_set_listener_callback(
491491
guard_condition,
492492
&EventsExecutor::push_event,
493-
get_callback_data(this, WAITABLE_EVENT),
494-
false /* Discard previous events */);
493+
get_callback_data(this, WAITABLE_EVENT));
495494

496495
if (ret != RCL_RET_OK) {
497496
throw std::runtime_error("Couldn't set guard condition event callback");
@@ -503,10 +502,7 @@ EventsExecutorEntitiesCollector::unset_guard_condition_callback(
503502
const rcl_guard_condition_t * guard_condition)
504503
{
505504
rcl_ret_t ret = rcl_guard_condition_set_listener_callback(
506-
guard_condition,
507-
nullptr,
508-
nullptr,
509-
false /* Discard previous events */);
505+
guard_condition, nullptr, nullptr);
510506

511507
if (ret != RCL_RET_OK) {
512508
throw std::runtime_error("Couldn't unset guard condition event callback");

0 commit comments

Comments
 (0)