From 9f03d4a3f7cb5df43fdac3d726e495ae2ee4f7e4 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Mon, 16 May 2011 17:03:51 -0400 Subject: [PATCH] doc/go_mem.html: close happens before receive on closed channel R=golang-dev, gri CC=golang-dev https://golang.org/cl/4551042 --- doc/go_mem.html | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/doc/go_mem.html b/doc/go_mem.html index da45a07d7ab..906b858e88a 100644 --- a/doc/go_mem.html +++ b/doc/go_mem.html @@ -1,5 +1,14 @@ + +

Introduction

@@ -213,6 +222,17 @@ the corresponding receive on c completes, which happens before the print.

+

+The closing of a channel happens before a receive that returns a zero value +because the channel is closed. +

+ +

+In the previous example, replacing +c <- 0 with close(c) +yields a program with the same guaranteed behavior. +

+

A receive from an unbuffered channel happens before the send on that channel completes.