打赏
摘要: golang异步任务 1. 文件目录 ├── go.mod ├── main.go └── workpool └── workpool.go 2. workpool/workpool.go文件 package workpool import ( "errors" "fmt" "log" "runti 阅读全文
posted @ 2020-10-24 17:42 苍山落暮 阅读(655) 评论(0) 推荐(0)
摘要: 1.起固定個數的goroutine package utils import ( "sync" ) type pool struct { queue chan int wg *sync.WaitGroup } func New(size int) *pool { if size <= 0 { siz 阅读全文
posted @ 2020-10-24 09:39 苍山落暮 阅读(146) 评论(0) 推荐(0)