比较快的睡眠排序

Rust
512
0
0
2022-11-10
    listArr := []int{3, 4, 5, 6, 7, 2, 3}
    a4list := sync.WaitGroup{}
    for _, v := range listArr {
        a4list.Add(1)
        go func(v int) {
            defer a4list.Done()
            time.Sleep(time.Millisecond * cast.ToDuration(v))
            fmt.Println(v)
        }(v)
    }
    a4list.Wait()