Re: [go-nuts] A problem about Happens Before

2021-02-23 Thread sanye
On 2/23/21 4:04 PM, Axel Wagner wrote: Because you have a concurrent read/write to a. Specifically, the Memory model says that "the go statement that starts a new goroutine happens before the goroutine's execution begins" . This means the first code is fine

Re: [go-nuts] A problem about Happens Before

2021-02-23 Thread 'Axel Wagner' via golang-nuts
Because you have a concurrent read/write to a. Specifically, the Memory model says that "the go statement that starts a new goroutine happens before the goroutine's execution begins" . This means the first code is fine - the write happens before the go statement, w