FAQ
I believe this blog post also has the answers you are looking for:

http://blog.golang.org/pipelines

On Tuesday, November 18, 2014 11:56:26 AM UTC-5, Francesc Campoy Flores
wrote:
You should definitely check the talk by John Graham-Cumming:

https://www.youtube.com/watch?v=woCg2zaIVzQ


On Tue, Nov 18, 2014 at 8:38 AM, Philip Thomas <philip...@gmail.com
<javascript:>> wrote:
I guess the main problem I am having is coordinating the shutdown of
multiple what I would call "queue workers" - basically one input channel,
one output channel, and about 1000 goroutines processing input, dropping
some data, and sending on the output channel. What's the standard pattern
for recognizing that the input channel has closed, then closing the output
channel when processing has finished without losing data (e.g. "ERROR -
output channel already closed"). I thought that the input shutdown message
could only be received by one queue worker, not all of them.

Philip

On Tue, Nov 18, 2014 at 7:17 AM, Jesper Louis Andersen <
jesper.lou...@gmail.com <javascript:>> wrote:
On Mon, Nov 17, 2014 at 10:04 PM, Philip Thomas <philip...@gmail.com
<javascript:>> wrote:
Can you examine the size of the buffer in the channel, e.g. to see if
it is empty or full, without modifying the channel?

Don't do this by asking for the length of the channel. Just try to read
a value out of the channel without blocking and handle the events from
there. It is pretty important to make sure your channel operations are safe
from data races. Otherwise you introduce small bugs in the code base which
are hard to find later on. It tend to be better to drive it by events on
the channels rather than looking at "side information".


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


--
--
Francesc Campoy
http://twitter.com/francesc
--
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

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 6 of 9 | next ›
Discussion Overview
groupgolang-nuts @
categoriesgo
postedNov 17, '14 at 9:04p
activeNov 18, '14 at 11:04p
posts9
users7
websitegolang.org

People

Translate

site design / logo © 2021 Grokbase