Skip to content

Commit b6c9ac3

Browse files
authored
Update volatile-in-cpp-cppcon-2024-notes.md
1 parent 67aa228 commit b6c9ac3

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

content/Blog/volatile-in-cpp-cppcon-2024-notes.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@ Slug: volatile-in-cpp-cppcon-2024-notes
66
> CppCon 2024 — What Volatile Means (and Doesn’t Mean), Ben Saks
77
> ([video][1], [slides][2])
88
9-
<div class="alert alert-warning" role="alert">
10-
⚠️ 本文根据视频字幕和 slides 由 AI 生成
11-
</div>
12-
139
---
1410

1511
## 0. 背景与提纲
@@ -362,6 +358,11 @@ void touch(Counter& c1, Counter& c2, const HotPair* hp) {
362358
* `volatile` 的**唯一核心价值**:告诉编译器“这里的读写可能有副作用,请**别省略、别合并、别重排**这些访问”。它**不会**解决线程可见性/顺序/原子性问题。
363359
* **多线程通信**:请用同步原语/原子库/内存序;`volatile` 不适用。
364360
* **工程上**:若你怀疑编译器把 `volatile` 搞坏了,优先考虑**局部关优化 / 换编译器版本 / 非内联包裹**三种方法,并**确认没被内联**。
361+
362+
<div class="alert alert-warning" role="alert">
363+
⚠️ 本文根据视频字幕和 slides 由 AI 生成
364+
</div>
365+
365366
366367
367368
[1]: https://www.youtube.com/watch?v=GeblxEQIPFM&list=PLHTh1InhhwT6U7t1yP2K8AtTEKmcM3XU_&index=2&t=2s

0 commit comments

Comments
 (0)