Skip to content
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

rxros::spin() funtion uses unnecessary many threads #15

Open
henrik7264 opened this issue Aug 31, 2019 · 2 comments
Open

rxros::spin() funtion uses unnecessary many threads #15

henrik7264 opened this issue Aug 31, 2019 · 2 comments

Comments

@henrik7264
Copy link
Collaborator

The rxros::spin() function is based on the ros::MultiThreadedSpinner. It is configured to use a spinner/thread for each available CPU core. This means that on a machine with 4 cores each an every node will take up at least 4 threads whether they the are needed or not.

Proposed solution:
The ros::spin() should per default only use one thread for spinning and take an argument that will allow the programmer to specify the needed number of spinners/threads.

@gavanderhoorn
Copy link
Member

Would it be an idea to leave spinning to the user? That is how roscpp also works, and unless rxros needs to do something special while spinning, might be a good approach to copy: it leaves the decision to the user, which both removes the problem from rxros and gives users more control.

If they don't want/need control, they could just do whatever they'd do normally with roscpp (probably copy-paste the ros::spin() line or use an ros::AsyncSpinner). If they do want control, they'd probably have a bit more insight into how things work and should be able to make an informed decision.

@henrik7264
Copy link
Collaborator Author

The idea with the rxros::spin() is to provide a simple wrapper around the ros::MultiThreadedSpinner and to give some consistency to the language. The programmer should to the extend possible be keept into rxros mindset. This is its main function.
If more control is needed the programmer can always fallback to ROS core functionality.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants