Making sense of Volatile
summary
Claim: "volatile" in C++ is usually the wrong tool for thread synchronization and is only appropriate for memory‑mapped I/O or CPU registers. Shows a small, working helper API: volatile_load/volatile_store functions and a typed register<Access,T> wrapper that enforce explicit volatile accesses and prevent accidental casts. Demonstrates why atomics or locks provide ordering and atomicity (use them for threads), explains pitfalls like memset/aliasing and += semantics, and recommends strict guidelines and isolated wrappers to avoid undefined behavior.
AI-written summary · about
chapters (6)
- 0:00Introduction
- 4:35Languages
- 11:00Volatile
- 19:14Volatile semantics
- 32:11When to use volatile
- 38:49Questions
related talks
47mSecure Coding in C and C++ - Volatility Ahead
01h 01mDeprecating volatile
01h 28mAtomic’s memory orders, what for?
01h 03mSafety: off --- How not to shoot yourself in the foot with C++ atomics
22mWhat we learned from C++ atomics and memory model standardization
01h 14m“C++ atomics, from basic to advanced. What do they really do?”
01h 01m“C++11/14/17 atomics and memory model..."
01h 23mElsewhere Memory (C++20 Abstract Machine) + Virtual Memory
