Re: [go-nuts] Is slice in golang thread-safe for appending

2017-01-19 Thread xiaohai dai
Wonderful! The example in ttps://play.golang.org/p/GsffpJc1cX is great. Thank you 在 2017年1月20日星期五 UTC+8上午7:04:02,freeformz写道: > > Which may or may not have the same backing array. > > https://play.golang.org/p/GsffpJc1cX > > PS: I probably should have just s

Re: [go-nuts] Is slice in golang thread-safe for appending

2017-01-19 Thread xiaohai dai
I see! Thank you! 在 2017年1月20日星期五 UTC+8上午6:40:30,freeformz写道: > > No, it is not.* > > * appending can replace the underlying array, so in certain situations it > can be, but that's more by accident IMO so just don't rely on that. > > On Thu, Jan 19, 2017 at 1:43 PM xiaohai dai > wrote: > >> I kn

Re: [go-nuts] Is slice in golang thread-safe for appending

2017-01-19 Thread Jason Stillwell
Oh I see, I was thinking of the more specific question "Is appending to slices thread-safe" On Thu, Jan 19, 2017 at 3:03 PM Edward Muller wrote: > Which may or may not have the same backing array. > > https://play.golang.org/p/GsffpJc1cX > > PS: I probably should have just said 'no. slices are n

Re: [go-nuts] Is slice in golang thread-safe for appending

2017-01-19 Thread Edward Muller
Which may or may not have the same backing array. https://play.golang.org/p/GsffpJc1cX PS: I probably should have just said 'no. slices are not "thread-safe"'. I have complicated the issue to no benefit. On Thu, Jan 19, 2017 at 2:56 PM Jason Stillwell wrote: > But it returns the new slice. >

Re: [go-nuts] Is slice in golang thread-safe for appending

2017-01-19 Thread Jason Stillwell
But it returns the new slice. On Thursday, January 19, 2017 at 2:40:30 PM UTC-8, freeformz wrote: > > No, it is not.* > > * appending can replace the underlying array, so in certain situations it > can be, but that's more by accident IMO so just don't rely on that. > > On Thu, Jan 19, 2017 at 1:4

Re: [go-nuts] Is slice in golang thread-safe for appending

2017-01-19 Thread Edward Muller
No, it is not.* * appending can replace the underlying array, so in certain situations it can be, but that's more by accident IMO so just don't rely on that. On Thu, Jan 19, 2017 at 1:43 PM xiaohai dai wrote: > I know that map in golang is not thread-safe for writing. > However, I'm not sure sl