FAQ

On Wednesday, May 11, 2011 5:11:55 AM UTC-7, Vladimir Sibirov wrote:
Can somebody show an example how to mux on arbitrary number of
channels? I mean channels coming from different goroutines, so it
isn't likely it is fine to use just one simple channel of struct
instead.

Should anyone come across this discussion today, 3 years later, there's
another solution: reflect.Select() takes an an arbitrary slice of
selectable objects and the return values are sufficient to emulate what the
keyword select does. Since the inputs are a slice you can alter the number
of channels dynamically. I have no idea whether it scales better than the
goroutine muxing suggestions.

   http://golang.org/pkg/reflect/#Select

-Nicolas S. Dade

--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedNov 14, '14 at 9:01p
activeNov 14, '14 at 9:01p
posts1
users1
websitegolang.org

1 user in discussion

Nic Dade: 1 post

People

Translate

site design / logo © 2022 Grokbase