Don't kick off all goroutines at once

This commit is contained in:
Stephen McQuay 2017-12-12 13:25:20 -08:00
parent c0a215f2bb
commit 60c49f9f7d
Signed by: sm
GPG Key ID: 4E4B72F479BA3CE5
1 changed files with 1 additions and 1 deletions

View File

@ -40,9 +40,9 @@ func main() {
wg := sync.WaitGroup{}
sema := make(chan bool, *conc)
for w := range work {
sema <- true
wg.Add(1)
go func(j job) {
sema <- true
defer func() {
wg.Done()
<-sema