使用boost在类函数中使用线程

个人记录,创建线程后,如果使用join则是子线程阻塞主线程,如果是detach则不阻塞。
这里是我的使用案例

void QNode::calculate_record_data()
{
    
    
   boost::thread process_thread(boost::bind(&QNode::calculate_record_data_in_thread,this));
   process_thread.detach();
   ROS_INFO("start calculate thread");
}

很好的参考文档
https://blog.csdn.net/jack_20/article/details/79892250

猜你喜欢

转载自blog.csdn.net/windxf/article/details/113140424