Skip to content

Commit

Permalink
Document that spin_once() should not be called from multiple threads (#…
Browse files Browse the repository at this point in the history
…1079)

* Document that spin_once() should not be called from multiple threads

Signed-off-by: AndyZe <[email protected]>
Signed-off-by: Shane Loretz <[email protected]>

---------

Signed-off-by: AndyZe <[email protected]>
Signed-off-by: Shane Loretz <[email protected]>
Co-authored-by: Shane Loretz <[email protected]>
  • Loading branch information
AndyZe and sloretz authored Oct 17, 2023
1 parent 5b7e531 commit df92d9e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions rclpy/rclpy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,9 @@ def spin_once(
It is possible the work done is for a node other than the one provided if the global executor
has a partially completed coroutine.
This method should not be called from multiple threads with the same node or executor
argument.
:param node: A node to add to the executor to check for work.
:param executor: The executor to use, or the global executor if ``None``.
:param timeout_sec: Seconds to wait. Block forever if ``None`` or negative. Don't wait if 0.
Expand Down
2 changes: 2 additions & 0 deletions rclpy/rclpy/executors.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,8 @@ def spin_once(self, timeout_sec: Optional[float] = None) -> None:
A custom executor should use :meth:`wait_for_ready_callbacks` to get work.
This method should not be called from multiple threads.
:param timeout_sec: Seconds to wait. Block forever if ``None`` or negative.
Don't wait if 0.
"""
Expand Down

0 comments on commit df92d9e

Please sign in to comment.