ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

is rospy.Publisher.publish() thread safe?

asked 2017-03-17 02:40:38 -0500

dyan gravatar image

Want to publish() in main and also in child thread on one rospy.Publisher(),is this safe?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2017-03-17 03:23:24 -0500

Yes, rospy.Publisher() is thread safe.

Before publishing a message it acquires a lock for thread safety and releases it after the message is sent.

You can see the source code here:

edit flag offensive delete link more

Question Tools



Asked: 2017-03-17 02:40:38 -0500

Seen: 1,392 times

Last updated: Mar 17 '17