Hi All,

Do we need a lock for assigning to different elements of an array while 
running parallel functions? For example is lock needed in the following 
code or not.

var rm sync.Mutex
var ts [2]stringfor i, s := range []string{"first", "second"} { i, s := i, s    
go func(){              rm.Lock()               ts[i] = s               
rm.Unlock()     }()}



Many thanks,
Ladan

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