总第105篇
本篇主要对C++11
中的线程std::thread
作全面的梳理和总结,方便以后在工作中参考和使用。
1.std::thread
介绍及示例
首先说明一下,对于以前的编译器, 若要使用C++11
的特性,编译时要设定参数如下:
-std=c++11
这里先写一个简单的线程示例程序。
#include <iostream>
#include <thread>
#include <string>
using namespace std;
void thread_one()
{
puts