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

> Do you find that incrementing the waitgroup on every accept tends to become a bottleneck?

The specific thing I was dealing with when I wrote the blog post wasn't high-volume enough for it to make any difference, so I don't really know....

But is there a better option than a WaitGroup here?



Check out the Context API, it's a standardization of several cancellation approaches.


Those two go hand in hand. Even if you you context (or a bare channel) for signaling the cancellation you often want to wait until the cancellation really happened and the child task terminated. For this task WaitGroup is the easiest thing to use.


And x/sync/errgroup if you want the lovechild of context and WaitGroup




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

Search: