On Tue, Jul 30, 2024 at 3:46 AM Heikki Linnakangas <hlinnaka@iki.fi> wrote:
> Aside from performance, I find "volatile" difficult to reason about. I
> feel more comfortable with atomics and memory barriers.
I think nearly everyone feels more comfortable with atomics and memory
barriers. The semantics of volatile are terrible. It almost does more
or less than what you actually wanted, sometimes both.
Reading Andres's original message, I couldn't help wondering if this
is an argument against rolling our own spinlock implementations.
Presumably a compiler intrinsic wouldn't cause this kind of
unfortunate artifact. Our position in the past has essentially been
"we know better," but this seems like a counterexample.
--
Robert Haas
EDB: http://www.enterprisedb.com