go 协程阻塞

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