ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
Issues with multi-threaded programs are usually caused by parallel accesses to shared data structures. Especially STL containers will die in a horrible way if two threads modify them simultaneously, or if a thread accesses them while another thread is writing to them.
Your code looks fine to me (provided the threads
array is large enough to hold all handles) and is probably not the source if your problem. Off the top of my head, I'd suggest you take a look at thread_align_cloud_init
and verify that anything that is not a local variable is either protected by a mutex or never accessed by two different threads. If other functions are called, the same rule applies to them as well.
2 | No.2 Revision |
Issues with multi-threaded programs are usually caused by parallel accesses to shared data structures. Especially STL containers will die in a horrible way if two threads modify them simultaneously, or if a thread accesses them while another thread is writing to them.
Your code looks fine to me (provided the threads
array is large enough to hold all handles) and is probably not the source if of your problem. Off the top of my head, I'd suggest you take a look at thread_align_cloud_init
and verify that anything that is not a local variable is either protected by a mutex or never accessed by two different threads. If other functions are called, the same rule applies to them as well.