3 ms·
> "volatile" will not help with this class of problem. Well, it's a good thing my comment had more words past that one. "volatile" is only part of the solution
by wtallis 2y ago
> "volatile" will not help with this class of problem.
Well, it's a good thing my comment had more words past that one. "volatile" is only part of the solution, and when more than one MMIO location is in play (as in your example), "volatile" on its own is insufficient but proper use of "volatile" plus explicit memory barriers will enforce correct ordering of loads and stores.