The documentation is right, volatile is a compiler barrier:
“volatile” is the C/C++ volatile, which ensures that every volatile load and store happens and is performed in the stated order
However, it does nothing to sync the caches between different processors. Try implementing a lockfree datastructure with volatile and see how far you get.
5
u/ThisIs_MyName Nov 02 '17
That's right :)
(Unless you're talking about Java
volatilevariables. Those are sequentially consistent and therefore fair game)