Hi gophers, The code "a = 1; b = 2;" within a goroutine does not ensure any "happens before" relation between these assignments for an external observer.
My doubt is with the code "a = 1; x.Lock(); b = 2;" where x is a sync.RWMutex. Does the spec (or the memory model or anything else) ensure that "a = 1;" happens before "x.Lock();" and that "x.Lock();" happens before "b = 2"? Does it ensure it for any method of x? The memory model ensures "happens before" relations between accesses to the same variables and between calls to the same mutexes. This example uses different variables: a != x, a != b and x != b, so it does not seem to be included by the model. Daniel. -- 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.