ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
In a typical ros node without Asynch/Multithreaded Spinners or something you do not have to take care about thread safety, i. e. you don't need blocking mechanisms. Any of your callbacks can only be called when your main process loop is calling ros::spin() or ros::spinOnce() and only one of our callbacks will be called at the same time (no parallel callbacks).
If you need parallel callbacks you should at this: http://wiki.ros.org/roscpp/Overview/Callbacks%20and%20Spinning
Keep in mind that if you use asynch/multithreaded spinning your callbacks might be executed parallel, i. e. you need blocking mechanisms, mutexes, condition variables and stuff.