go-dlv试用 发表于 2017-12-09 | 分类于 技术积累 | | 1 源码 12345678910111213141516171819202122232425package mainimport ( "fmt" "sync" "time")func dostuff(wg *sync.WaitGroup, i int) { fmt.Printf("goroutine id %d\n", i) time.Sleep(300 * time.Second) fmt.Printf("goroutine id %d\n", i) wg.Done()}func main() { var wg sync.WaitGroup workers := 10 wg.Add(workers) for i := 0; i < workers; i++ { go dostuff(&wg, i) } wg.Wait()} Last Updated 2017-12-10 Sun 16:57.Render by hexo-renderer-org with Emacs 25.3.2 (Org mode 8.2.10)