From 941f515d616904886dab5937347efe77b9a30e9c Mon Sep 17 00:00:00 2001 From: Eli Bendersky Date: Thu, 6 May 2021 06:17:54 -0700 Subject: [PATCH] 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 --- examples/goroutines/goroutines.sh | 7 ++++--- public/goroutines | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/examples/goroutines/goroutines.sh b/examples/goroutines/goroutines.sh index 1d42ee2..e452c25 100644 --- a/examples/goroutines/goroutines.sh +++ b/examples/goroutines/goroutines.sh @@ -1,7 +1,8 @@ # When we run this program, we see the output of the -# blocking call first, then the interleaved output of the -# two goroutines. This interleaving reflects the -# goroutines being run concurrently by the Go runtime. +# blocking call first, then the output of the two +# goroutines. The goroutines' output may be interleaved, +# happens because goroutines are being run concurrently +# by the Go runtime. $ go run goroutines.go direct : 0 direct : 1 diff --git a/public/goroutines b/public/goroutines index d6dacbb..25fe86b 100644 --- a/public/goroutines +++ b/public/goroutines @@ -157,9 +157,10 @@ separate goroutines now. Wait for them to finish

When we run this program, we see the output of the -blocking call first, then the interleaved output of the -two goroutines. This interleaving reflects the -goroutines being run concurrently by the Go runtime.

+blocking call first, then the output of the two +goroutines. The goroutines’ output may be interleaved, +happens because goroutines are being run concurrently +by the Go runtime.