Re:Updating the Go Memory Model
by tapirl on Monday July 12, 2021 @09:12PM
(#27816797)
> Unless I've missed it in my reading, I don't see any of these clearly stating that the single-return form of channel receive will fabricate zero values when misused, or describing how you need to replace a closed channel with a nil when selecting on multiple channels to avoid spinning the CPU when it's been closed.
You certainly missed this: https://golang.org/ref/spec#Close
You might also need read https://blog.golang.org/pipelines and https://blog.golang.org/concurrency-timeouts
If you need a good summary, you could read my articles: * https://go101.org/article/channel.html * https://go101.org/article/channel-use-cases.html * https://go101.org/article/channel-closing.html