3 ms·
There is a more standard way of doing that with a blocking channel. c := make(chan struct{}, 10) for job := range jobs { c <- struct{}{} go func(){
by Thaxll 6y ago
There is a more standard way of doing that with a blocking channel.
c := make(chan struct{}, 10)
for job := range jobs {
c <- struct{}{}
go func(){
defer func() { <-c }()
}(job)
}