-
Notifications
You must be signed in to change notification settings - Fork 430
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[documentation] Explain when MultiThreadedExecutor
is running multiple threads
#2454
base: rolling
Are you sure you want to change the base?
[documentation] Explain when MultiThreadedExecutor
is running multiple threads
#2454
Conversation
@Cakem1x btw, can you also address DCO error? |
It includes a note about which methods support multithreaded execution. Signed-off-by: Matthias Holoch <[email protected]>
This reverts commit e751e1f. Signed-off-by: Matthias Holoch <[email protected]>
Signed-off-by: Matthias Holoch <[email protected]>
…ture_complete Signed-off-by: Matthias Holoch <[email protected]>
Co-authored-by: Tomoya Fujita <[email protected]> Signed-off-by: Matthias Holoch <[email protected]>
b6e4e81
to
17929ce
Compare
@@ -61,8 +61,12 @@ class MultiThreadedExecutor : public rclcpp::Executor | |||
RCLCPP_PUBLIC | |||
virtual ~MultiThreadedExecutor(); | |||
|
|||
/// Multi-threaded implementation of spin. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Multi-thread 😸
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that the new documentation is misleading.
/** | ||
* \sa rclcpp::Executor:spin() for more details | ||
* This function will block until work comes in, and try to execute all work with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not correct.
This function won't block until works come in, but rather it will block until interrupted.
This is a tiny PR that adds a class docstring for the
MultiThreadedExecutor
. It includes a note about which methods support multithreaded execution.Please let me know if this is not the right way to suggest additions to the documentation.
Also, please double check if the note is actually true or can be improved.
My context:
I have a unit test with two nodes that communicate with each other and I use the
MultiThreadedExecutor
to spin both of these nodes. One node publishes a TF, the other one regularly waits for that TF.In the individual test cases, I have been using
multi_threaded_executor_.spin_until_future_complete(some_future);
. This leads to a flaky test that sometimes succeeds and sometimes fails. The reason for that seems to be that theMultiThreadedExecutor
is only using a single thread whenspin_until_future_complete
is used. The test would fail (timeout) if the work item from node that waits for the TF gets executed first. Waiting for the TF blocks the main thread until timeout, while the other node that should supply that TF will not get executed.After changing my test setup to use
multi_threaded_executor_.spin();
in a separate thread and just dosome_future.wait_for(...)
in the test cases, everything is working fine.So, after finding all that out, I thought I could maybe help others by adding a note somewhere. Just skimming through the API docs, that behavior was not clear to me.
Thanks for having a look!