Glad someone mentioned reflect.Select. Implemented simple round robin
solution with a timeout case (if no data is available at all) using just
that .
To add to some priority would be just be a matter of setting the
channel/cases to nil after several writes, rather than just after one like
I do
On Jan 25, 2017, at 8:00 AM, 'Axel Wagner' via golang-nuts
wrote:
> It's also a feature rabbit-hole. I'd predict, that next up, someone who
> experiences starvation wants to add weighted scheduling ("give this case an
> 80% chance of succeeding and this other case 20%, so that eventually eith
On Wednesday, January 25, 2017 at 10:14:49 PM UTC+8, Jan Mercl wrote:
>
> On Wed, Jan 25, 2017 at 2:14 PM T L >
> wrote:
>
> > sometimes, I do want one case on a select block get selected even if
> there are multiple unblocked cases.
> > For example, I don't want the dataCh case is selected if
On Wed, Jan 25, 2017 at 2:14 PM T L wrote:
> sometimes, I do want one case on a select block get selected even if
there are multiple unblocked cases.
> For example, I don't want the dataCh case is selected if the stopCh and
the timer channel are unblocked:
select {
case <-priorit
sometimes, I do want one case on a select block get selected even if there
are multiple unblocked cases.
For example, I don't want the dataCh case is selected if the stopCh and the
timer channel are unblocked:
select {
case <- stopCh:
return
case value := <-dataCh:
}
select {
case <- time.A