You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Start an output goroutine for each input channel in cs. output// copies values from c to out until c is closed or it receives a value// from done, then output calls wg.Done.output:=func(c<-chanint) {
forn:=rangec {
select {
caseout<-n:
case<-done:
}
}
wg.Done()
}
I think it will never reach wg.Done(), or may be I am wrong?
The text was updated successfully, but these errors were encountered:
But if you read carefully, "or it receives a value from done, then output calls wg.Done." So will not be closed in case it receives done, needs to wait for c also! In such case selecting on done is useless.
In
Go Concurrency Patterns: Pipelines and cancellation, blog post is example which state like this
I think it will never reach wg.Done(), or may be I am wrong?
The text was updated successfully, but these errors were encountered: