标签:bsp 运行 index one ack style UNC span dex
package main import ( "fmt" "sync" ) func print(idx int, wg *sync.WaitGroup) { fmt.Printf("index %d: \n", idx) wg.Done() } func main() { var wg sync.WaitGroup for i := 0; i < 10; i++ { wg.Add(1) go print(i, &wg) } wg.Wait() }
运行结果: index 3 index 7 index 9 index 1 index 2 index 4 index 0 index 5 index 6 index 8
标签:bsp 运行 index one ack style UNC span dex
原文地址:https://www.cnblogs.com/zengyjun/p/10062471.html