On Wed, Aug 24, 2016 at 2:49 AM, Chintan Sheth <shethchint...@gmail.com> wrote:
> I am using select statement to dispatch work coming from multiple
> goroutines, the variables used to consume the channel are allocated manually
> as I am recycling those
>
>
> for {
>  a := getA()
>  b := getB()
>  select {
>  case a = <-chan1:
>   go doSomething(&a)
>  case b = <-chan2:
>   go doSomething2(&b)
>  }
> }
>
>
> This obviously does not work while listening on more than one channel, as I
> wasting a get() call for the other type, is there any way to do some
> "prework" before consuming the channel

There is no way to do any prework.

For this example, why not just send a pointer on the channel?

Ian

-- 
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.

Reply via email to