ros-industrial / ros_canopen

CANopen driver framework for ROS (http://wiki.ros.org/ros_canopen)
GNU Lesser General Public License v3.0
340 stars 272 forks source link

Fix race condition in shutdown behavior #453

Open bochen87 opened 2 years ago

bochen87 commented 2 years ago

The behaviour we're observing with the ThreadedSocketCANInterface is similar to what is described here: https://stackoverflow.com/questions/68787876/boostasio-server-code-causes-segfault-only-some-of-the-time-seemingly-relat

This seems to fix those segfaults happening at shutdown. Somehow it only works though if I put it into the dtor, not if I put it into the shutdown_internal function - then it's basically not possible to shut it down anymore.