On Thu, Aug 31, 2017 at 05:08:23AM -0700, Jason E. Aten wrote: > A question for those familiar with the runtime internals of channel close > and channel receive: [...] > Will closing a channel in the middle of a send introduce the possibility of > data corruption? The language spec guarantees a panic, and that panics > can be recovered, but would a *reader* of ch above ever see incorrect data?
AFAIK, all operations on a channel happen in-order and are fully serialized. That is, close() will wait until the currently active operation is active, if any. In other words, close() on a channel is not like closing an OS file descriptor -- even though the operation's names are the same. -- 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 [email protected]. For more options, visit https://groups.google.com/d/optout.
