I don't see where your `waiter()` function is used in your example. I have
been lurking till now but I concur with the other people who have told you
your proposal doesn't make any situation easier to deal with and in fact is
likely to be the source of bugs.

On Thu, Feb 21, 2019 at 10:43 PM Serhat Şevki Dinçer <jfcga...@gmail.com>
wrote:

> Another use case is wait groups with Max number of goroutines allowed:
>
> ch:= make(chan bool, 10)
>
> func waiter() {
>   ch <-true
>   go worker()
>
>   // when empty, all jobs are finished
>   waitempty(ch)
> }
>
> func worker() {
>   // do work
>
>   Select {
>   ch <- true:
>     go worker() // try to handover some jobs
>   default:
>     // max goroutine limit
>     // do them yourself
>   }
>
>   // do remaining jobs
>
>   // make way
>   <- ch
>   return
> }
>

-- 
Kurtis Rader
Caretaker of the exceptional canines Junior and Hank

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to