Re: [go-nuts] is this code thread safety?

2017-11-03 Thread Drew Derbyshire
What Jan said. I had started my own post before I realize other sane people checked in about the absurd colors. On Thursday, November 2, 2017 at 3:13:07 AM UTC-7, Jan Mercl wrote: > > On Thu, Nov 2, 2017 at 6:54 AM sheepbao > wrote: > > > the close function is thread

Re: [go-nuts] is this code thread safety?

2017-11-03 Thread 'Bryan Mills' via golang-nuts
In general you can use the race detector to help answer this sort of question, although it does not detect all races. Unfortunately, it doesn't detect this one. (I've filed https://golang.org/issue/22569, because I think it should.) On Friday, November 3, 2017 at 4:08:19 AM UTC-4, sheepbao

Re: [go-nuts] is this code thread safety?

2017-11-03 Thread sheepbao
Thanks, I got it. On Friday, November 3, 2017 at 11:26:31 AM UTC+8, Jesse McNelis wrote: > > On Thu, Nov 2, 2017 at 4:54 PM, sheepbao > wrote: > > > > the close function is thread safety? how about call `closed` at the same > > time. > > It's not safe. Multiple

Re: [go-nuts] is this code thread safety?

2017-11-02 Thread Jesse McNelis
On Thu, Nov 2, 2017 at 4:54 PM, sheepbao wrote: > > the close function is thread safety? how about call `closed` at the same > time. It's not safe. Multiple goroutines can enter the 'default' case in that select and close() the channel multiple times. "Sending to or