/**两人同时打印,竞争资源输出:
F:\goWorkSpace\study\05协程>go run 08_解决多任务资源竞争问题.go
wheolrlldo 并不是helloword,为了解决此问题;后续我们来学习chanel*/package main
import ("fmt""time"
)
func Printer(str string){for _,data:=range str{fmt.Printf("%c",data)time.Sleep(time.Second)}}
func person1(){Printer("hello")
}
func person2(){Printer("world")
}func main(){//新建两个协程,代表两个人去打印,2个人同时使用打印机go person1()go person2()for{}}