This was my attempt at a channel with priorities:

https://git.bug-br.org.br/bga/channels/src/master/priority/channel_adapter.go

Based on the assumption that priorities only make sense if items are
queued. If they are pulled out from a channel as fast as they are added to
it, then there is no need for priorization.


On Thu, May 23, 2019 at 1:38 AM roger peppe <rogpe...@gmail.com> wrote:

> Oops, forgot to include the playground link at the end there:
> https://play.golang.org/p/mYSRsGb4mRA
>
> On Thu, 23 May 2019 at 09:38, roger peppe <rogpe...@gmail.com> wrote:
>
>> On Thu, 23 May 2019 at 01:34, Anthony Metzidis <
>> anthony.metzi...@gmail.com> wrote:
>>
>>> Fun thought exercise -- here's another approach.
>>>
>>>
>>> https://play.golang.org/p/Xu7iWhY4PUQ
>>>
>>
>> ISTM that that approach doesn't work because you're buffering 10 values
>> before you send any.
>> So if you have a situation when you've got very little traffic on all the
>> channels, a message might
>> get delayed indefinitely.
>>
>> For example, here's your example with only one message being sent - it
>> hasn't arrived
>> at the receiver after 5 seconds have elapsed.
>>
>>   cheers,
>>     rog.
>>
>> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-nuts/CAJhgaciGHN633%2BCWtYE6Gw4i8pdB9XoQ5HbOiHR1X06oJxMdCQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/golang-nuts/CAJhgaciGHN633%2BCWtYE6Gw4i8pdB9XoQ5HbOiHR1X06oJxMdCQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAEd86TxVW6_vhjTq47pe8z8Rp18CymtD5U1iKBJg%3DB4ufo-HXg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to