There does still need to be a mutex for reads on an element that is being written to. It's a minor edge case but it could cause a serious problem when it hoppens.
On Monday, 23 April 2018 08:36:38 UTC+3, Tamás Gulácsi wrote: > > If there's no uncoordinated write and read/write of the same slot, then > it's race-free. > > Only reads does not need coordination. > > I'm using a pattern alike: allocate a slice for the results, start the > goroutines, each writing into it's own slot, then wait all of them to > complete, and use the result array. > Here the "wait all" is crucial! > > -- 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.