From: Walter Fetter Lages Date: Wed, 19 Dec 2018 11:53:23 +0000 (-0200) Subject: Fix scope problem in handPubThread. Join it. X-Git-Url: http://git.ece.ufrgs.br/?a=commitdiff_plain;h=1975ed5b9b7680d929c48718a8561e49edfd66d4;p=ufrgs_wam.git Fix scope problem in handPubThread. Join it. --- 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; }