std::vector<std::thread> threads
时间: 2023-08-25 14:13:48 浏览: 161
C++多线程封装成类使用示例
是一个存放std::thread对象的vector。这段代码展示了如何创建一个std::vector<std::thread>对象,并使用循环将多个std::thread对象添加到vector中。每个std::thread对象都执行一个lambda函数,该函数打印出线程的标识符。最后,通过循环调用join()函数,等待每个线程执行完成。这样做可以实现多线程的并发执行。<em>1</em><em>2</em><em>3</em>
#### 引用[.reference_title]
- *1* *2* [【C++11 并发编程教程 - Part 1 : thread 初探(bill译)】](https://blog.csdn.net/weixin_33738578/article/details/92188996)[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^v92^chatsearchT3_1"}} ] [.reference_item]
- *3* [C++11 并发编程教程 - Part 1 : thread 初探](https://blog.csdn.net/u012432785/article/details/52104346)[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^v92^chatsearchT3_1"}} ] [.reference_item]
[ .reference_list ]
阅读全文