private int Read(IRingBufferReader reader, Action <IEnumerable <long> > callback) { long lastAvailable = reader.WaitAvailable(); var items = new List <long>(); for (long seq = reader.Position; seq <= lastAvailable; seq++) { int value = _buffer[seq]; items.Add(value); } if (items.Count > 0) { callback(items); reader.Move(lastAvailable + 1); } return(items.Count); }
private int Read(IRingBufferReader reader, Action<IEnumerable<long>> callback) { long lastAvailable = reader.WaitAvailable(); var items = new List<long>(); for (long seq = reader.Position; seq <= lastAvailable; seq++) { int value = _buffer[seq]; items.Add(value); } if (items.Count > 0) { callback(items); reader.Move(lastAvailable + 1); } return items.Count; }