This commit is contained in:
Mark McGranaghan 2012-09-16 16:23:57 -07:00
parent 098a71ef89
commit 7854ae3cdf

18
41-synchronization.go Normal file
View File

@ -0,0 +1,18 @@
package main
import "fmt"
import "time"
func printer(done chan<- bool) {
for i := 0; i < 10; i++ {
time.Sleep(time.Millisecond * 100)
fmt.Println(i)
}
done <- true
}
func main() {
done := make(chan bool, 1)
go printer(done)
<- done
}