FAQ
... that's the point. If the channel is a "done" channel, it's there only
to signal when the taks it's done, there's no value to process (that's why
I would use a chan of struct{}).
So when you want to wait for the task to be completed, you do:
<-done
And that blocks until the channel gets closed (when the job is done). And
you get nothing (an empty struct) out of the channel, because there's no
data to process.
(hope I didn't misunderstand your question)

On Wednesday, July 29, 2015 at 9:35:07 PM UTC+2, Justin Israel wrote:

But what if a zero value is a valid channel value to process? A done
channel would mean done.
--
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 7 | next ›
Discussion Overview
groupgolang-nuts @
categoriesgo
postedJul 29, '15 at 2:14p
activeJul 29, '15 at 9:12p
posts7
users5
websitegolang.org

People

Translate

site design / logo © 2022 Grokbase