github.com/lingyao2333/mo-zero@v1.4.1/core/fx/parallel.go (about)

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