Re:Cmd/compile: Go 1.8 regression: sync/atomic loop elided
by wbl on Monday February 20, 2017 @12:37PM
(#13689159)
No. Read the spec. There is no deadline for atomics to be visible. What is true is that some operations have happens-before ordering, and if a store happens-before a load, the load will see the result of the store.
Re:Cmd/compile: Go 1.8 regression: sync/atomic loop elided
by gpderetta on Monday February 20, 2017 @01:00PM
(#13689379)
Did you reply to the wrong post? My post was only about ordering.
Still the C++ spec has wording about making stores visible in a reasonable time. The wording is non-normative as they run out of time (ah!) while trying to come up with a more formal (and implementable) specification.
edit: oh, I see I wrote 'default visibility' instead of 'default ordering'.
It is possible to have a model where all atomic operations are relaxed (i.e. unordered) and use explicit barriers for ordering (which is closer to how some, but not all, CPUs work), but it is significantly harder to reason about and prove algorithms correct under it.
edit: wording