mirror of
https://github.com/golang/go
synced 2024-11-22 01:24:42 -07:00
go_mem: clarified unbuffered channel sync example
R=rsc CC=golang-dev https://golang.org/cl/218063
This commit is contained in:
parent
b0fba898ef
commit
2551cf9d1a
@ -190,7 +190,8 @@ the send on that channel completes.
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
This program:
|
This program (as above, but with the send and receive statements swapped and
|
||||||
|
using an unbuffered channel):
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
@ -222,7 +223,7 @@ before the <code>print</code>.
|
|||||||
If the channel were buffered (e.g., <code>c = make(chan int, 1)</code>)
|
If the channel were buffered (e.g., <code>c = make(chan int, 1)</code>)
|
||||||
then the program would not be guaranteed to print
|
then the program would not be guaranteed to print
|
||||||
<code>"hello, world"</code>. (It might print the empty string;
|
<code>"hello, world"</code>. (It might print the empty string;
|
||||||
it cannot print <code>"hello, sailor"</code>, nor can it crash.)
|
it cannot print <code>"goodbye, universe"</code>, nor can it crash.)
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<h3>Locks</h3>
|
<h3>Locks</h3>
|
||||||
|
Loading…
Reference in New Issue
Block a user