Eli Bendersky 61e8dde1c1 Use time.Sleep instead of fmt.Scanln to wait for goroutines
The Scanln doesn't work on the Go playground

Fixes #279
2019-09-20 14:55:41 -07:00

17 lines
412 B
Bash

# 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.
$ 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.