1. 首页
  2. 数据库
  3. 其它
  4. C++11/14 线程的创建与分离的实现

C++11/14 线程的创建与分离的实现

上传者: 2020-12-30 05:24:22上传 PDF文件 80.38KB 热度 6次
线程的创建 让我们看看示例代码(t1.cpp). #include #include void thread_function() { std::cout << "thread function\n"; } int main() { std::thread t(&thread_function); // 线程 t 开始运行 std::cout << "main thread\n"; t.join(); // 主线程等待子线程结束 return 0; } 代码在linux系统下将输出:
下载地址
用户评论