Comment Re:perspective (Score 1) 509
Valid use of volatile is indeed for a memory location updated by a signal handler in a single-threaded program, or DMA, or as you say, a hardware interrupt. It's been quite a few years since I did any of that.
In a threaded program any volatile usage is highly suspect without at least a comment to justify and indicate the source of the idiom (e.g. double checked locking which is now the standard idiom to initialize an instance variable since Java 1.5 fixed the flaw). Situations where synchronization is clearly overkill and volatile is obviously strong enough are actually quite rare.
It's just an odd little habit of mine to exploit that suspicion and misuse the underused and frequently misused volatile keyword to highlight an unfixed concurrency problem when reviewing code. It looks so blatantly wrong that I find it much harder to ignore than a mere FIXME comment, and it precisely identifies the broken variable.