Would this work?
select { case val := <-high: continue default: } select { case val := <-high: case val := <-high: case val := <-high: case val := <-low: } On Monday, July 23, 2012 at 2:16:16 PM UTC-7, Erwin wrote: > > Hello, > > i wonder how to implement channel priorities nicely. Say there are two > channels, one with a higher priority than the other, and a goroutine > waiting for incoming data on these channels. I have read that select picks > a random case when multiple channels are ready. I thought of nesting > selects: putting the lower priority select in the default case of the > higher priority select, and have the default case of the inner (low > priority) select do nothing. This leads to a kind of busy wait loop. I > could call a short sleep, but that still isn't very clean. Is there a > better way? > > Why aren't the select cases evaluated in order? > -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/16f55340-540c-4528-a5e9-005ec57edd59%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.