From 1975ed5b9b7680d929c48718a8561e49edfd66d4 Mon Sep 17 00:00:00 2001 From: Walter Fetter Lages Date: Wed, 19 Dec 2018 09:53:23 -0200 Subject: [PATCH] Fix scope problem in handPubThread. Join it. --- wam_node_sim/src/wam_node_sim.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/wam_node_sim/src/wam_node_sim.cpp b/wam_node_sim/src/wam_node_sim.cpp index 10fcf0e..b6a3d70 100644 --- a/wam_node_sim/src/wam_node_sim.cpp +++ b/wam_node_sim/src/wam_node_sim.cpp @@ -817,7 +817,8 @@ int main(int argc,char *argv[]) WamNode<7> wam_node(wam,bhand); ros::Rate loop(PUBLISH_FREQ); - if(useHand) std::thread handPubThread(&WamNode<7>::publishHand,&wam_node); + std::thread handPubThread; + if(useHand) handPubThread=std::thread(&WamNode<7>::publishHand,&wam_node); while (ros::ok()) { @@ -827,5 +828,6 @@ int main(int argc,char *argv[]) loop.sleep(); } + handPubThread.join(); return 0; } -- 2.12.0