parallel.go 248 B

123456789101112
  1. package fx
  2. import "git.i2edu.net/i2/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. }