C++11-thread(join detach joinable)

#include
#include //c++11中 thread的头文件 C++11中的很多函数都放到了std库里面

void testThread()
{
   std::cout << "this is funciton: " << __func__ << std::endl;
}
int main()
{
    std::cout << "first function: "<<__func__ << std::endl;
    std::thread th1(testThread);
    th1.join();
    std::cout << __func__ << " end" << std::endl;
}

你可能感兴趣的:(thread(join,detach))