1
0
mirror of https://github.com/golang/go synced 2024-11-21 15:24:45 -07:00

doc/go_mem.html: close happens before receive on closed channel

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/4551042
This commit is contained in:
Russ Cox 2011-05-16 17:03:51 -04:00
parent 2ddcad96d7
commit 9f03d4a3f7

View 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.