golang waitgroup with timeout code example
Example: golang waitgroup
var wg sync.WaitGroup
for i := 1; i <= 5; i++ {
wg.Add(1)
go func(wg *sync.WaitGroup) {
wg.Done()
}()
}
wg.Wait()
var wg sync.WaitGroup
for i := 1; i <= 5; i++ {
wg.Add(1)
go func(wg *sync.WaitGroup) {
wg.Done()
}()
}
wg.Wait()