Thanks Dave. It seems though that whatever select chooses to run (A or B) the program takes 1000 ms to complete. I would expect the program to finish in 100 ms if A is chosen or 1000 ms in the case of B. I wonder if both functions are evaluated concurrently no matter which case select chooses. If this is true, does anyone know what kind of concurrency is the select statement using underneath?
Cheers, Pablo On Wednesday, September 7, 2016 at 8:35:11 AM UTC+10, Dave Cheney wrote: > > Here's the same program rewritten. > > https://play.golang.org/p/ANHNUcPjR2 > > If ch is writable, then select pseudo randomly chooses the first or second > case. The default case is never taken unless ch is blocked, in which case > the goroutine will block sending to ch indefinitely. > > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.