Eli Bendersky a9507f5bbb
Clarify comment for the goroutines sample (#366)
* 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

* Fix phrasing in comment
2021-08-30 07:17:25 -07:00

18 lines
426 B
Bash

# When we run this program, we see the output of the
# blocking call first, then the output of the two
# goroutines. The goroutines' output may be interleaved,
# because goroutines are being run concurrently by the
# Go runtime.
$ go run goroutines.go
direct : 0
direct : 1
direct : 2
goroutine : 0
going
goroutine : 1
goroutine : 2
done
# Next we'll look at a complement to goroutines in
# concurrent Go programs: channels.