Goroutines example needs a time.Sleep() #103

Open
ysagal opened this Issue Mar 31, 2015 · 0 comments

1 participant

@ysagal

Without time.Sleep(), the execution of goroutines isn't interleaved. It might also be worth noting in this early example why a Scanln is required—main() won't wait for goroutines to finish and since they're returned immediately getting to the end of main() ends the execution.

➜  goroutines git:(master) go run goroutines.go
direct : 0
direct : 1
direct : 2
goroutine : 0
goroutine : 1
goroutine : 2
going

done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment