标签: thread
与该标签相关的所有文章 "thread".
-
现代 C++(五):内存模型、atomic、thread 与 future
C++11 之前没有语言级内存模型,多线程代码在编译器 + CPU 双重乱序下不可能正确(Hans Boehm 2005 论文证明)。C++11 一次性引入内存模型、std::atomic、std::thread、std::future 四件套,给了 C++ 官方并发语义。六种 memory order 是理解的核心——在 x86 上 release/acquire 几乎免费、seq_cst 要 mfence,在 ARM 上差距更大,这正是暴露细粒度 order 的意义。