C++11 多线程
•
C++11 新标准中引入了四个头文件来支持多线程编程,他们分
别是
<atomic> ,<thread>,<mutex>,<condition_variable> 和
<future> ;
•
<thread> :该头文件主要声明了 std::thread 类,另外
std::this_thread 命名空间也在该头文件中;
•
<atomic> :该头文主要声明了两个类 , std::atomic 和
std::atomic_ag ,另外还声明了一套 C 风格的原子类型和与
C 兼容的原子操作的函数;
•
<mutex> :该头文件主要声明了与互斥量 (mutex) 相关的类,
包括 std::mutex 系列类, std::lock_guard,
std::unique_lock, 以及其他的类型和函数;
评论0