Re: [go-nuts] go's memory model for unbuffered channels

2018-04-25 Thread Ian Lance Taylor
On Wed, Apr 25, 2018 at 2:27 AM, wrote: > > So it always guarantees to print "hello world" for the unbuffered channel, > doesn't it? > > package main > var c = make(chan int) > var a string > > func f() { > a = "hello, world" > c <- 0 > } > > func main() { >

Re: [go-nuts] go's memory model for unbuffered channels

2018-04-25 Thread threebearsdan
So it always guarantees to print "hello world" for the unbuffered channel, doesn't it? package main *var c = make(chan int)* var a string func f() { a = "hello, world" *c <- 0* } func main() { go f() *<-c* print(a) } it will guarantee to print "hello, world". package