Can a single service client be used from multiple threads?
I have a use case where I have a changing number of threads needing to make service calls to the same service. I don't want to bring service clients up and down each time these threads start as they are short lived and need to start quickly, and I don't want to need to create a "service client pool" if I don't need to.
So:
- Are
ServiceClient
s thread-safe enough to be called from multiple threads? - If not, is it sufficient to mutex around the
ServiceClient::call
? - Do the answers to the previous questions depend on ROS release? (I'm stuck on electric for this project)
I assume you are talking about roscpp (I have tagged your question as such). If that's incorrect, please change the tag.
Yes. Thanks, forgot about the distinction.