Thanks for your reply.
However, I don't think reading and writing w.last concurrently will lead to 
data race.
In my opinion, concurrent writing to w.last may lead to data race, but 
reading and writing concurrently here may not.
Look forward to your reply again.

在 2017年1月20日星期五 UTC+8下午1:03:07,Ian Lance Taylor写道:
>
> On Thu, Jan 19, 2017 at 7:05 PM, xiaohai dai <seaf...@gmail.com 
> <javascript:>> wrote: 
> > I am reading "Data Race Detector"  from Godoc. 
> > However, I'm confused by the example: Primitive unprotected variable 
> > displayed in the post. I don't know why this example could lead to data 
> > race. 
>
> The assumption is that there is some other code, not shown, that calls 
> the KeepAlive method.  Setting the w.last field in KeepAlive races 
> with reading it in the goroutine started in Start. 
>
> 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.

Reply via email to