weixin_39946239 2020-11-29 15:21
浏览 0

examples: Stop LCM thread before destroying its receivers

The DrakeLcm object launches a thread, that by default is not stopped until the DrakeLcm destructor. Other classes might register "upon receipt of message" callbacks onto it, where DrakeLcm retains a pointer to user code that handles new messages. Depending on the DrakeLcm declaration order with respect to other objects on the local stack, the message recipient might be destroyed prior to the DrakeLcm being destroyed, which means the thread might call back into garbage.

Here, we explicitly stop the thread prior to destroying any objects, so that we can be sure they are always safe to delete.

Closes #9697. Closes #9809. Closes #6634.

Relates to #7524, though some bugs beyond this patch still remain according to CI.

This change is Reviewable

该提问来源于开源项目:RobotLocomotion/drake

  • 写回答

9条回答 默认 最新

  • weixin_39946239 2020-11-29 15:21
    关注

    -jenkins-bot linux-xenial-gcc-bazel-experimental-memcheck-asan please -jenkins-bot linux-xenial-gcc-bazel-experimental-memcheck-tsan please

    评论

报告相同问题?