Skip to content

Commit 2cc43b3

Browse files
update doc section for spin_xxx methods. (#2730)
Signed-off-by: Tomoya Fujita <[email protected]> Co-authored-by: William Woodall <[email protected]>
1 parent 6069c3d commit 2cc43b3

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

rclcpp/include/rclcpp/executor.hpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,18 @@ class Executor
287287
* Adding subscriptions, timers, services, etc. with blocking or long running
288288
* callbacks may cause the function exceed the max_duration significantly.
289289
*
290+
* Work that is ready to be done is collected only once, and when collecting that work
291+
* entities which may have multiple pieces of work ready will only be executed at most
292+
* one time.
293+
* The reason for this is that it is not possible to tell if, for example, a ready
294+
* subscription has only one message ready or multiple without checking again.
295+
* Because, in order to find out if there are multiple messages, one message must
296+
* be taken and executed before checking again if that subscription is still ready.
297+
* However, this function only checks for ready entities to work on once,
298+
* and so it will never execute a single entity more than once per call to this function.
299+
* See spin_all() variants for a function that will repeatedly work on a single entity
300+
* in a single call.
301+
*
290302
* If there is no work to be done when this called, it will return immediately
291303
* because the collecting of available work is non-blocking.
292304
* Before each piece of ready work is executed this function checks if the

0 commit comments

Comments
 (0)