go-zero/core/fx/parallel.go

12 lines
199 B
Go
Raw Normal View History

2020-07-26 17:09:05 +08:00
package fx
2020-08-08 16:40:10 +08:00
import "github.com/tal-tech/go-zero/core/threading"
2020-07-26 17:09:05 +08:00
func Parallel(fns ...func()) {
group := threading.NewRoutineGroup()
for _, fn := range fns {
group.RunSafe(fn)
}
group.Wait()
}