Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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)
  }


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: