mirror of
https://gitee.com/johng/gf
synced 2026-06-07 02:12:11 +08:00
24 lines
329 B
Go
24 lines
329 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"sync"
|
|
"time"
|
|
|
|
"github.com/gogf/gf/os/gtime"
|
|
)
|
|
|
|
func main() {
|
|
start := gtime.TimestampMilli()
|
|
wg := sync.WaitGroup{}
|
|
for i := 0; i < 100000; i++ {
|
|
wg.Add(1)
|
|
go func() {
|
|
time.Sleep(time.Second)
|
|
wg.Done()
|
|
}()
|
|
}
|
|
wg.Wait()
|
|
fmt.Println("time spent:", gtime.TimestampMilli()-start)
|
|
}
|