go-zero/core/fx/parallel.go

13 lines
251 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
2021-02-19 17:49:39 +08:00
// Parallel runs fns parallelly and waits for done.
2020-07-26 17:09:05 +08:00
func Parallel(fns ...func()) {
group := threading.NewRoutineGroup()
for _, fn := range fns {
group.RunSafe(fn)
}
group.Wait()
}