ringbuffer的特别之处

在这里插入图片描述
嗯,正如名字所说的一样,它是一个环(首尾相接的环),你可以把它用做在不同上下文(线程)间传递数据的buffer。

我们实现的ring buffer和大家常用的队列之间的区别是,我们不删除buffer中的数据,也就是说这些数据一直存放在buffer中,直到新的数据覆盖他们。这就是和维基百科版本相比,我们不需要尾指针的原因。ringbuffer本身并不控制是否需要重叠(决定是否重叠是生产者-消费者行为模式的一部分–如果你等不急我写blog来说明它们,那么可以自行检出Disruptor项目)。

U2FsdGVkX1/erXRjB/Q8D/BVJKh+fgcKAVv8JLcTRgbOWSpvES3BW7SnIXaheJD3
PIrxrg1Xz9N7DB3xE2TfVQG37VLJhQ4K19Rca8uSzXO7M7tWcWtXASLfuQXzTC/p
KGy7E1qHaDhfsnw/Z8QxM6oAFbh3fUDGDaI2dHkH4g6oQVdOUFyQeZjBAeKdYjz8
B1Qrui5hAYcH/KPYQ5J+noUAHeTAIzGdTRT7ZI6KYUwOJiuO4P8zyWehwA4JMDtE
r6ciHP07Y3/wxSrxswbM5XJKfLKwwsgKLUGobCyFWOX5llz83yf6rGwzuj1h+pcA
e7Vg04P3YZUnq53P4OSxIsXKR5h78HgwHNcnG22F0/bNr1iETU713p0MnkYfoLRD
+KnA5d8drIGuidjcfmBfRJi4UsRhu9XviHLbHoJjcojkoDZs/QWlZkpI/OjvLRkh
6oYi0l6nsNYsBHpCUYoAzRYljJVga/nLTYHDWzznbh72gnzeN5AREFvng1LkJzMA
t/nKhfgNA5Q5rgrA9XRbalZPa23l/doQ8ChCQdcyPhtsr2VV8uRUin5JX/fpKUI6
Oh+uC0vP8jp4t0lrNihUb7W2OuFJIzrEyNCueOSX/vuSHGvBHsJyFZoFASBytysa
d6ZFqAA4XKh5oN6HDgBP0T7oj+hQBOdZK58oUoSNBz/wycLuP/qV9ALzooe/f+oC
Fz4948euvtJih6Y185OxDk3mvsHhUfeqh0fusJljg7Gat+OofNwbsHB7xsIvCok5
1Pg+40YvnNL7169dIYQfEI1EojXKHlkAWQ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