Those idioms should be documented somewhere! I would use waiting groups for the rest of the job, i don't know.. have to think a little more.. you got the number of background task to wait for, right?
El jueves, 21 de febrero de 2019, 10:47:07 (UTC-3), Jan Mercl escribió: > > On Thu, Feb 21, 2019 at 2:38 PM Serhat Şevki Dinçer <jfcg...@gmail.com > <javascript:>> wrote: > > Idiom 1 > > waitempty(ch) > > blocks caller until ch buffer is empty > > Not exactly the same, but a similar mechanism exists: > > select { > case x := <-ch: > ... > default: > ... ch is empty > } > > > waitfull(ch) > > blocks caller until ch buffer is full > > Idiom 2 > Dtto > > select { > case ch <- x: > ... > default: > ... ch is full > } > > > > What do you think? > > That the above is enough of gears to implement what you're after. > > -- > > -j > -- 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.