github.com/ndau/noms@v1.0.5/go/util/functions/all.go (about) 1 // Copyright 2016 Attic Labs, Inc. All rights reserved. 2 // Licensed under the Apache License, version 2.0: 3 // http://www.apache.org/licenses/LICENSE-2.0 4 5 package functions 6 7 import "sync" 8 9 // All runs all functions in |fs| in parallel, and returns when all functions have returned. 10 func All(fs ...func()) { 11 wg := &sync.WaitGroup{} 12 wg.Add(len(fs)) 13 for _, f_ := range fs { 14 f := f_ 15 go func() { 16 f() 17 wg.Done() 18 }() 19 } 20 wg.Wait() 21 }