Re: [go-nuts] Is channel push atomic?

2018-03-08 Thread Jan Mercl
On Fri, Mar 9, 2018 at 8:19 AM Andrey Tcherepanov < xnow4fippy...@sneakemail.com> wrote: > So if this is a "just" a mutex, this whole thing will not be atomic - it would introduce intermediate (albeit invisible) between "<-" parts. I was hoping for the "edge collapse" here. Not sure IIUC, but I

Re: [go-nuts] Is channel push atomic?

2018-03-08 Thread Andrey Tcherepanov
Thanks Jan, So if this is a "just" a mutex, this whole thing will not be atomic - it would introduce intermediate (albeit invisible) between "<-" parts. I was hoping for the "edge collapse" here. Andrey On Friday, March 9, 2018 at 12:08:13 AM UTC-7, Jan Mercl wrote: > > On Fri, Mar 9, 2018

Re: [go-nuts] Is channel push atomic?

2018-03-08 Thread Jan Mercl
On Fri, Mar 9, 2018 at 7:47 AM Andrey Tcherepanov < xnow4fippy...@sneakemail.com> wrote: > ch <- <-ch // Is this an atomic operation? Channel send and receive operations are safe wrt to concurrency. That may be seen atomic in a certain sense: only one goroutine at a time can ever perform such

Re: [go-nuts] Is channel push atomic?

2018-03-08 Thread Henrik Johansson
What do you mean atomic? The individual operations create happens before edges afaik and since your channel is local there is nothing to worry about. If you publish that channel then no I would say someone else can puh or pull in between the two operations. fre 9 mars 2018 kl 07:47 skrev Andrey

[go-nuts] Is channel push atomic?

2018-03-08 Thread Andrey Tcherepanov
Hello fellow nuts, Is pull-push to a (same) channel atomic? func f() { ch := make(chan interface{}, 100) // ... ch <- <-ch // Is this an atomic operation? } Thank you very much! -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To