From b7952c5f494663d5e03b40fbe6bf0fb072c6483e Mon Sep 17 00:00:00 2001 From: Shinnosuke Hirakawa Date: Mon, 1 Mar 2021 20:15:36 +0900 Subject: [PATCH] fix how to kill a thread Signed-off-by: Shinnosuke Hirakawa --- pandar_driver/src/driver/nodelet.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pandar_driver/src/driver/nodelet.cpp b/pandar_driver/src/driver/nodelet.cpp index 5d062b2..7d7c66f 100644 --- a/pandar_driver/src/driver/nodelet.cpp +++ b/pandar_driver/src/driver/nodelet.cpp @@ -15,12 +15,12 @@ class DriverNodelet : public nodelet::Nodelet ~DriverNodelet() { - if (running_) { - NODELET_INFO("shutting down driver thread"); - running_ = false; + NODELET_INFO("shutting down driver thread"); + running_ = false; + if(deviceThread_.joinable()){ deviceThread_.join(); - NODELET_INFO("driver thread stopped"); } + NODELET_INFO("driver thread stopped"); } private: