package main
import (
"fmt"
"time"
)
func main() {
//缓存通道
done := make(chan bool,1)
go worker(done)
//等待读取chan,当chan没数据时会阻塞
<-done
}
func worker(done chan bool) {
fmt.Print("working...")
time.Sleep(time.Second)
fmt.Println("done")
done <- true
}