On Sat, Aug 26, 2017 at 4:34 AM, honzajde <[email protected]> wrote:
>
> Back to the primary question: Is it safe to read condition if I add a break
> to the loop like this?

Yes.  sync.WaitGroup.Wait would be useless if it didn't provide a
happens-before relationship from changes made in the goroutine that
calls Done to the goroutine that calls Wait.

I suppose this could be documented in the docs for sync.WaitGroup, but
it also kind of falls under the "Go is not trying to trick you" rule.

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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to