bluespace-ai / bluespace_ai_xsens_ros_mti_driver

xsens ros2 driver
BSD 3-Clause "New" or "Revised" License
47 stars 63 forks source link

Remove the call to isAlive() which is broken #17

Closed pshved closed 6 months ago

pshved commented 1 year ago

The update of glibc from 2.31 to 2.35 in Ubuntu changed the semantics of pthread_kill. It used to return an error when a dead thread exited, and now it returns 0.

This new behavior is POSIX-compatible as the result of pthread_kill on a thread that died produces undefined behavior, so techincally 0 is valid result.

This isAlive() will return that a dead thread is alive in the newer glibc versions.

This patch removes the use of isAlive and instead uses tryjoin, which should behave correctly for dead threads.

pshved commented 1 year ago

This patch needs more work tho, with error conditions not being correctly handled. Hold off on accepting it please

waltejon commented 1 year ago

This commit helped me to fix https://github.com/bluespace-ai/bluespace_ai_xsens_ros_mti_driver/issues/16.

pshved commented 1 year ago

I've added a missing check for error, so this should be good to go.