]> Cypherpunks.ru repositories - gostls13.git/commitdiff
doc/go_mem.html: close happens before receive on closed channel
authorRuss Cox <rsc@golang.org>
Mon, 16 May 2011 21:03:51 +0000 (17:03 -0400)
committerRuss Cox <rsc@golang.org>
Mon, 16 May 2011 21:03:51 +0000 (17:03 -0400)
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/4551042

doc/go_mem.html

index da45a07d7ab1ca790e8cf647be246ee2dfa3450f..906b858e88a660c70b86d511465034e055d284e1 100644 (file)
@@ -1,5 +1,14 @@
 <!-- The Go Memory Model -->
 
+<style>
+p.rule {
+  font-style: italic;
+}
+span.event {
+  font-style: italic;
+}
+</style>
+
 <h2>Introduction</h2>
 
 <p>
@@ -213,6 +222,17 @@ the corresponding receive on <code>c</code> completes, which happens before
 the <code>print</code>.
 </p>
 
+<p class="rule">
+The closing of a channel happens before a receive that returns a zero value
+because the channel is closed.
+</p>
+
+<p>
+In the previous example, replacing
+<code>c &lt;- 0</code> with <code>close(c)</code>
+yields a program with the same guaranteed behavior.
+</p>
+
 <p class="rule">
 A receive from an unbuffered channel happens before
 the send on that channel completes.