]> Cypherpunks repositories - gostls13.git/commitdiff
spec: clarify a couple of issues about channels
authorRob Pike <r@golang.org>
Wed, 31 Jul 2013 21:12:32 +0000 (07:12 +1000)
committerRob Pike <r@golang.org>
Wed, 31 Jul 2013 21:12:32 +0000 (07:12 +1000)
1. They are FIFOs.
2. They are safe for concurrent access.

Fixes #5911.

R=golang-dev, dvyukov, adg
CC=golang-dev
https://golang.org/cl/11549043

doc/go_spec.html

index 3f6ea8668cff161b0b5ee841118d8b139b96a8ae..f582231c50499347b488951b9f8fac5e88a9eed9 100644 (file)
@@ -4126,6 +4126,20 @@ A send on a closed channel proceeds by causing a <a href="#Run_time_panics">run-
 A send on a <code>nil</code> channel blocks forever.
 </p>
 
+<p>
+Channels act as first-in-first-out queues.
+For example, if a single goroutine sends on a channel values
+that are received by a single goroutine, the values are received in the order sent.
+</p>
+
+<p>
+A single channel may be used for send and receive
+operations and calls to the built-in functions
+<a href="#Length_and_capacity"><code>cap</code></a> and
+<a href="#Length_and_capacity"><code>len</code></a>
+by any number of goroutines without further synchronization.
+</p>
+
 <pre>
 ch &lt;- 3
 </pre>