Is it safe to call a service in a separate thread

asked 2018-09-08 15:47:29 -0600

shylent gravatar image

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 service_client.cpp and service_server_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).

edit retag flag offensive close merge delete