I don't think the Go memory model provides any guarantee here. In particular, x==0, y==1 is allowed at the end. There is no happens-before relationship between both of the final reads and either of their writes. So those reads are allowed to observe those writes, or not. The fact that x=1 happens before y=1, or that there is some other synchronization happening between them that establishes happens-before relationships with other goroutines, is irrelevant.
-- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.