go 协程阻塞

时间:2020-06-17 10:42:28   收藏:0   阅读:81
func main() {

	wg.Add(2)
	go test1()
	go test2()
	wg.Wait()
}

func test1()  {
	defer wg.Done()
	for i:=0;i<10;i++{
		fmt.Println(i)
	}
}

func test2()  {
	defer wg.Done()
	for i:=0;i<10;i++{
		fmt.Println(i)
	}
}

  

原文:https://www.cnblogs.com/php-linux/p/13150644.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!