Volatile
This section discusses the volatile keyword.
We'll cover the following...
Volatile
Informally, the volatile
keyword forbids any reordering and caching optimizations to be applied on a field marked volatile. More formally, when a volatile
field is read an acquire-fence is generated and when it is written to a release-fence is generated.
Let's see an example to clarify these concepts. Consider the snippet below. ...