On Wed, Nov 30, 2016 at 1:31 PM, Daniel Fanjul <daniel.fanjul.alcu...@gmail.com> wrote: > Case A: because there is a write and then a method call that does not touch > that variable. The go memory model apply only to reads and writes of the > same variables. So any possible reordering in this scenario fulfills "the > reordering does not change the behavior within that goroutine as defined by > the language specification". > > Case C: because there is a read and a method call that does not touch that > variable. Same corollary.
Would you apply the same argument to calls to the Lock and Unlock methods of a sync.Mutex? After all, the original code could be rewritten to use Lock and Unlock calls, and presumably that would be OK. If you agree with that, then I think it is sufficient to say that WaitGroup is implemented using sync.Mutex. Ian -- 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.