On 11/3/16 10:22 PM, Ian Lance Taylor wrote:
> On Thu, Nov 3, 2016 at 10:19 PM, 刘桂祥 <liuguixiang...@gmail.com> wrote:
>>   can you explain why whis ?
> A map is basically a pointer to a complex data structure.  Setting a
> value in a map changes that data structure.  If one goroutine is
> reading from the data structure while a different goroutine is writing
> to the data structure, the results are completely unpredictable.  In
> the worst case they could even cause the program to crash.
>

I've seen an even worse case than this: subtle misbehaviors.  In my
case, some timers weren't firing and I had no idea why until 'go test
-race' pointed out the concurrent map writes & accesses.

Sam

-- 
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.

Reply via email to