go-zero/core/fx/parallel.go

13 lines
252 B
Go
Raw Normal View History

2020-07-26 17:09:05 +08:00
package fx
import "github.com/zeromicro/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()
}