【C++学习笔记】C++ 标准库 std::thread 的简单使用,一文搞定还不简单?

std::thread是 C++ 11 新引入的标准线程库。在同样是 C++ 11 新引入的 lambda 函数的辅助下,std::thread用起来特别方便: int a = 1; std::thread thread([a](int b) {     return a + b; }, 2); 它唯一有点令人疑惑的地方在于其提供的join和detach函数,字面上的意思是前者合并线程,后者分离线
相关文章
相关标签/搜索