diff --git a/rmw_fastrtps_shared_cpp/src/rmw_wait.cpp b/rmw_fastrtps_shared_cpp/src/rmw_wait.cpp index 9f05e50c5..a934a7dfb 100644 --- a/rmw_fastrtps_shared_cpp/src/rmw_wait.cpp +++ b/rmw_fastrtps_shared_cpp/src/rmw_wait.cpp @@ -254,6 +254,10 @@ __rmw_wait( } if (!has_data) { subscriptions->subscribers[i] = 0; + } else { + // We are returning a ready subscription, + // so we need to indicate that the wait was successful. + wait_result = true; } } } @@ -268,6 +272,10 @@ __rmw_wait( custom_client_info->response_reader_->get_first_untaken_info(&sample_info)) { clients->clients[i] = 0; + } else { + // We are returning a ready client, + // so we need to indicate that the wait was successful. + wait_result = true; } } } @@ -282,6 +290,10 @@ __rmw_wait( custom_service_info->request_reader_->get_first_untaken_info(&sample_info)) { services->services[i] = 0; + } else { + // We are returning a ready service, + // so we need to indicate that the wait was successful. + wait_result = true; } } } @@ -317,6 +329,10 @@ __rmw_wait( if (!active) { events->events[i] = 0; + } else { + // We are returning a ready event, + // so we need to indicate that the wait was successful. + wait_result = true; } } } @@ -327,8 +343,12 @@ __rmw_wait( auto condition = static_cast(data); if (!condition->get_trigger_value()) { guard_conditions->guard_conditions[i] = 0; + } else { + condition->set_trigger_value(false); + // We are returning a ready guard condition, + // so we need to indicate that the wait was successful. + wait_result = true; } - condition->set_trigger_value(false); } }