std::thread::join
时间: 2023-09-16 19:15:09 浏览: 73
C++简单多线程案例
4星 · 用户满意度95%
std::thread::join是一个成员函数,用于等待线程的结束。在引用的代码中,d2.join()函数的作用是让主线程等待d2线程的执行完成,直到d2线程结束才能继续执行主线程的后续代码。具体来说,d2线程调用了join()函数,表示主线程要等待d2线程的任务完成才能继续执行。通过调用join()函数,可以避免主线程在d2线程还没有完成任务时退出,从而确保程序的正确执行。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [std::thread --join()](https://blog.csdn.net/shunlu5586/article/details/127783112)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *2* [c++11中关于std::thread的join的详解](https://download.csdn.net/download/weixin_38690079/12750322)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *3* [C++ std::thread join()函数调用](https://blog.csdn.net/baidu_28398971/article/details/126362262)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
[ .reference_list ]
阅读全文