Earlier quoted context omitted.
I don't use Go. https://go.dev/ref/mem If I'm reading this correctly, they are recommending a lock in this situation. However, they are saying the implementations has two options, either raise an error reporting the race (if the implementation is told to do so), or, because the value being read is not larger than a machine word, reply to the read with a correct value from a previous write. If true then it cannot repl…
> However, they are saying the implementations has two options, either raise an error reporting the race (if the implementation is told to do so), or, because the value being read is not larger than a machine word, reply to the read with a correct value from a previous write. The spec says > A read r of a memory location x holding a value that is not larger than a machine word must observe some write w such that r do…
> that unsynchronized reads of a uint64 will return some previous valid write, it doesn't guarantee anything about which value is returned
Your the second person saying this, so is my interpretation that this is dissallowed by the part that you quoted incorrect?
> must observe some write w such that r does not happen before w and there is no write w' such that w happens before w' and w' happens before r
edit: somebody is answering this below by the way