I may be trying to suggest more than I properly understand, but looking at src for WaitGroup,
- Done() calls and Add(-1) which in turn calls atomic.AddUint64() that should be a store-release - Wait() calls a atomic.LoadUint64() that should be a load-acquire So anything written before calling Done() should be visible after Wait() sees the effects of Done() (even though everything above is undocumented) On Saturday, August 20, 2016 at 4:04:18 PM UTC+5:30, Konstantin Shaposhnikov wrote: > > The code might be race free for the current Go implementation but I don't > think this behaviour is documented. > > https://golang.org/ref/mem doesn't mention sync.WaitGroup at all. So > wg.Done() doesn't necessarily happen before wg.Wait() returns and the > effect of writing to "result" could be not visible after wg.Wait(). > > On Saturday, 20 August 2016 07:43:52 UTC+1, Jan Mercl wrote: >> >> On Sat, Aug 20, 2016 at 8:29 AM Yulrizka <yulr...@gmail.com> wrote: >> >> > He argues that this is heap race condition. >> >> I don't know what is a heap race condition but the code is race free. >> >> -- >> >> -j >> > -- 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.