首页 > 技术文章 > c++多线程并发编程视频

yyjy-edu 2020-10-10 14:53 原文

demo线程使用

#include <iostream>
#include <thread>
#include <future>
using namespace std;

void helloworld()
{
    cout << "hello world \n";
}

int main()
{
   
    //开启一个线程
    std::thread t(helloworld);
    std::cout << "hello world main thread\n";
   
    //线程的终结
    t.join();
   
    return 0;
}

 

推荐阅读