parallel.go 251 B

123456789101112
  1. package fx
  2. import "github.com/tal-tech/go-zero/core/threading"
  3. // Parallel runs fns parallelly and waits for done.
  4. func Parallel(fns ...func()) {
  5. group := threading.NewRoutineGroup()
  6. for _, fn := range fns {
  7. group.RunSafe(fn)
  8. }
  9. group.Wait()
  10. }