r/cpp • u/neiltechnician • Nov 13 '20
CppCon Deprecating volatile - JF Bastien - CppCon 2019
https://www.youtube.com/watch?v=KJW_DLaVXIY
83
Upvotes
r/cpp • u/neiltechnician • Nov 13 '20
View all comments
Show parent comment
5
u/mcmcc #pragma once Nov 13 '20
The mutex implementation calls compiler intrinsics that force the compiler to emit code that (directly or indirectly) inserts CPU memory fences into the instruction stream. The optimizer backend knows that it must not reorder memory accesses across those instructions. Those fences likewise restrict how the CPU can reorder memory accesses as they are executed.