标签:c++11
设计到网络请求的地方一般都需要用到线程,C++11标准中增加了thread,下面是最简单的一个线程使用示例。
#include <iostream>
#include <thread>
void thread_task()
{
std::cout << "thread task" << std::endl;
}
int main()
{
std::thread t(thread_task);
t.join();// pauses until t finishes
return 0;
}g++ -std=c++11 -pthread thread.cpp
标签:c++11
原文地址:http://blog.csdn.net/xufeng0991/article/details/44751655