Clarify comment for the goroutines sample.

The current comment may be interpreted to say that the output must be
interleaved, when in fact it doesn't have to be (it depends on the order
the goroutines are run). Make the comment more permissive to avoid the
confusion.

Fixes #365
This commit is contained in:
Eli Bendersky 2021-05-06 06:17:54 -07:00
parent 58e66a8103
commit 941f515d61
2 changed files with 8 additions and 6 deletions

View File

@ -1,7 +1,8 @@
# When we run this program, we see the output of the # When we run this program, we see the output of the
# blocking call first, then the interleaved output of the # blocking call first, then the output of the two
# two goroutines. This interleaving reflects the # goroutines. The goroutines' output may be interleaved,
# goroutines being run concurrently by the Go runtime. # happens because goroutines are being run concurrently
# by the Go runtime.
$ go run goroutines.go $ go run goroutines.go
direct : 0 direct : 0
direct : 1 direct : 1

7
public/goroutines generated
View File

@ -157,9 +157,10 @@ separate goroutines now. Wait for them to finish
<tr> <tr>
<td class="docs"> <td class="docs">
<p>When we run this program, we see the output of the <p>When we run this program, we see the output of the
blocking call first, then the interleaved output of the blocking call first, then the output of the two
two goroutines. This interleaving reflects the goroutines. The goroutines&rsquo; output may be interleaved,
goroutines being run concurrently by the Go runtime.</p> happens because goroutines are being run concurrently
by the Go runtime.</p>
</td> </td>
<td class="code leading"> <td class="code leading">