…tity
collect_and_execute_ready_events() computed the deadline as
start + max_duration. With a max_duration of 0, which means no limit, the
deadline had already passed, so spin_some() and spin_all(0) returned after
the first executed entity. Treat 0 as no time limit, as
Executor::spin_some_impl() does.
An entity that was added after its callback group needed up to three
spin_some() calls before it was served: executing the notify guard
condition event requests the sync, executing the sync function only sets
needs_callback_group_resync, and the resync ran at the start of the next
call. If the executed work requested a resync, resync and collect once
more instead of returning.
Add a test that several ready waitables are all executed by one
spin_some() and one spin_all(0), and enable the spin_some warm-up tests
for the EventsCBGExecutor.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: mini-1235 <mauricepurnawan@gmail.com>
Description
EventsCBGExecutor::spin_some()andspin_all(0)executed one ready entity per call, and an entity added after its callback group needed up to threespin_some()calls before it was served.Both changes are in
collect_and_execute_ready_events():max_durationof 0 now means no time limit, as inExecutor::spin_some_impl(). Before, the deadline wasstart + 0, so the loop stopped after the first entity.spin_some()resyncs and collects once more instead of returning. Before, the resync only ran at the start of the next call.Fixes #3414
Is this user-facing behavior change?
Yes. One
spin_some()call now executes all events that were ready when it was called, andspin_all(0)runs until no work is left.spin_some()can execute the same entity several times in one call, once per event that was queued at the start, likerclcpp::experimental::executors::EventsExecutor. The wait-set executors execute an entity once per call.Did you use Generative AI?
Yes, Claude Fable 5.2
Additional Information