On Sat, Nov 14, 2020 at 7:54 PM Robert Engels <reng...@ix.netcom.com> wrote:

> I don’t think a ring buffer works. At least in a traditional ring buffer
> the producer cannot pass the consumer - if the buffer is full the producer
> blocks or drops. Trying to ensure the consumer always reads the most recent
> available item is better (and more simply) served with a shared hand off
> queue.
>

It is trivial to create a ring buffer type that drops the oldest queued
item when appending a new item if the ring is full. Which would seem to be
the behavior the O.P. wants. The important question in this scenario is
whether such an object must be useful in a `select` statement. If not the
implementation is borderline trivial.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CABx2%3DD82zaBDcyuCPGayqLmf0oHA7SYi2uNaZ2WYUOAsrAzVag%40mail.gmail.com.

Reply via email to