地址:<https://github.com/ryanskidmore/parallel>
## 安装
> go get -u github.com/ryanskidmore/parallel
## 使用
```go
package main
import (
"log"
"fmt"
"github.com/ryanskidmore/parallel"
)
func main() {
p := parallel.New() // Create a new instance of parallel
worker, err := p.NewWorker("worker1", ¶llel.WorkerConfig{Parallelism: 1}) // Create a new worker
if err != nil {
log.Fatalf("FATAL: Failed to create new worker: %v", err)
}
worker.SetExecution(func(wh *parallel.WorkerHelper, args interface{}) { // Set the worker execution function
fmt.Println(args)
wh.Done()
})
worker.Start(interface{}("Test String")) // Start with worker with specified args
worker.Wait() // Wait for the worker to complete
}
```
有疑问加站长微信联系(非本文作者)