Closed pshved closed 6 months ago
This patch needs more work tho, with error conditions not being correctly handled. Hold off on accepting it please
This commit helped me to fix https://github.com/bluespace-ai/bluespace_ai_xsens_ros_mti_driver/issues/16.
I've added a missing check for error, so this should be good to go.
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.