ringbuffer到底是什么?嗯,正如名字所说的一样,它是一个环(首尾相接的环),你可以把它用做在不同上下文(线程)间传递数据的buffer。我们实现的ring buffer和大家常用的队列之间的区别是,我们不删除buffer中的数据,也就是说这些数据一直存放在buffer中,直到新的数据覆盖他们。这就是和维基百科版本相比,我们不需要尾指针的原因。ringbuffer本身并不控制是否需要重叠(决定是否重叠是生产者-消费者行为模式的一部分–如果你等不急我写blog来说明它们,那么可以自行检出Disruptor项目)。
U2FsdGVkX1++xMzQkzsQbQcEHiWNw7ULnRk18TZHtfXytzcUrwmNZxxy8crUWQ0m
1A15okLnF+Vvz3BquetLnhQASqA6Uwm6Y9Vk7bVQqZpHUOcxxfh4TVuVMG4aERbdZmY1xC93vu+cDX8plIdrpS6ADBtr/ngVdeyPZjYiwvzmqnf56evw+yuww3rL0KlWx6S13i2+CRz8O95mNNzyQWO9izMbc5FUq+19tcrzeOBkkUGWaV1WoMuLTlpzagWokWroD0EvMtUjMtYYlGdgn7aMgTQOs0hwUO+tOtT0a3GjLPE1S9CNgOwXIwPy74lSat3FbKfSinx566Yv78amjjfG7JSeqgOE/yK7+cimo9llzKKc4IUFiU1uejrzBbI57qP5Tl9Z41yCJoiEnRtpN+Ylcc1uwjQsvm2y/3Npph9ZJONF+5bWZYTCN3ih3Y23M7y9SB1t7V+lDdqCtVaRBtnRxtNo7U0RahS5SDr0kWhhrDIj3ycLCTqpaJIs10FPZ5ZY7djcWKJg38n6iRS7OPPdVK1RTNHDOLgOCzopcFy4AuI3P7AtZXHs5gwvjOM2O0+ZLA+Zei5tjCxGaCDgKKoCcrtyB/59Ylv/mSUVBitvjjxpcIcwrUzuzBsZ27f1nG1eAQRxSyvyxWe9sZFbcvjh4bYdTrD+OudA/cmXxYGn0FRMHZKVkBawt+198rtwlLXwFs/dz/D/ME5d0Il2nAz0lQpp+HJ2nxmVWKWP+77UT0ZRpI5tBMiglTtwHxjheAwcGLrTipU8wCSlggBqQehtVZm5KQcF7nBi2eiv+9Kc/2sbzz9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