mirror of
https://github.com/golang/go
synced 2024-11-21 16:04: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:
parent
2ddcad96d7
commit
9f03d4a3f7
@ -1,5 +1,14 @@
|
|||||||
<!-- The Go Memory Model -->
|
<!-- The Go Memory Model -->
|
||||||
|
|
||||||
|
<style>
|
||||||
|
p.rule {
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
span.event {
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
<h2>Introduction</h2>
|
<h2>Introduction</h2>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
@ -213,6 +222,17 @@ the corresponding receive on <code>c</code> completes, which happens before
|
|||||||
the <code>print</code>.
|
the <code>print</code>.
|
||||||
</p>
|
</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 <- 0</code> with <code>close(c)</code>
|
||||||
|
yields a program with the same guaranteed behavior.
|
||||||
|
</p>
|
||||||
|
|
||||||
<p class="rule">
|
<p class="rule">
|
||||||
A receive from an unbuffered channel happens before
|
A receive from an unbuffered channel happens before
|
||||||
the send on that channel completes.
|
the send on that channel completes.
|
||||||
|
Loading…
Reference in New Issue
Block a user