mirror of
https://gitee.com/johng/gf.git
synced 2024-12-05 05:37:55 +08:00
20 lines
244 B
Go
20 lines
244 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"github.com/gogf/gf/g/os/grpool"
|
|
"time"
|
|
)
|
|
|
|
func main() {
|
|
p := grpool.New(1)
|
|
for i := 0; i < 10; i++ {
|
|
v := i
|
|
p.Add(func() {
|
|
fmt.Println(v)
|
|
time.Sleep(3*time.Second)
|
|
})
|
|
}
|
|
time.Sleep(time.Minute)
|
|
}
|