If you have serious performance needs, then something like the "Disruptor" pattern is useful. There are ports of that from Java to Go out there, but I don't know how stable or useful they are.
The Disruptor pattern is to keep a circular ring-buffer of elements. The writer and each reader keeps track of where they are in the ring by means of atomic counters. By keeping track of where the slowest reader is, you can track if everyone has read the value in the ring. The atomic counters acts like barriers which make sure when you can trust a slot in the ring to be correctly updated. The solution is very efficient if you have a single-writer, many reader broadcast where speed is of essence. But I'd definitely not go down this path unless you hit a wall and need to squeeze out more performance. These systems tend to need an ample amount of testing before they can be deemed stable and data-races tend to lurk around every corner you look. On Tue, Oct 17, 2017 at 12:35 PM st ov <so.qu...@gmail.com> wrote: > that's an great article thank you! > > > On Sunday, October 15, 2017 at 6:51:03 PM UTC-7, dja...@gmail.com wrote: >> >> This post might help: >> >> https://rogpeppe.wordpress.com/2009/12/01/concurrent-idioms-1-broadcasting-values-in-go-with-linked-channels/ >> >> Djadala >> >> On Sunday, October 15, 2017 at 11:36:36 PM UTC+3, st ov wrote: >>> >>> A value sent through a channel can be read by only one reader, so once >>> its read its no longer available to other readers is that right? >>> >>> In what ways can I pass/communicate/distribute a value through a channel >>> and have it shared across an unknown number of readers? >>> >> -- > 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. > -- 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.