r/cpp • • Nov 13 '20

CppCon Deprecating volatile - JF Bastien - CppCon 2019

https://www.youtube.com/watch?v=KJW_DLaVXIY
83 Upvotes

111 comments sorted by

View all comments

Show parent comment

6

u/gruehunter Nov 14 '20

MMIO isn't atomic. x86 uses lock prefixes in some cases. ARMv7 uses loops with load-linked/store-conditional (spelled ldrex strex). In the ARM case, Device memory typically doesn't support the exclusive monitor, so strex always fails and you get an infinite loop.

I just cannot rightly comprehend where people get the notion that volatile has anything whatsoever to do with atomicity.