Robotics StackExchange | Archived questions

Is it safe to call a service in a separate thread

Is it safe to call a service (ServiceClient::call) in a thread, that is different from the "current" thread and / or the thread, that is running spin / spinOnce (assuming, single-threaded spinner is used)? I've checked the code in serviceclient.cpp and serviceserver_link.cpp and it is not entirely clear to me, if it is.

This is done so that the blocking nature of the service call does not interfere with periodic activity of the node. I understand, that in this case an action would've been preferrable, but I can not change that (the functionality is already implemented as a service on the processing side).

Asked by shylent on 2018-09-08 15:47:29 UTC

Comments

Answers