On Fri, Jul 08, 2011 at 10:59:14PM +0200, Arnold Krille wrote:
Empty for reading. Lots of space for writing.
Its much more interesting to see what happens when the indezes cross the 2^32
or 2^64 mark, then the write-index will be smaller then the read-index untill
the read-index catches up. But as far as I see currently, this wouldn't be a
problem either. The writer only has to stop writing when its at read_ptr - 1.
It is assumed that the buffer is used correctly, so no one does e.g
a wr_commit(n) with n > wr_avail(), same for read. There is no
problem with wraparound at 2^32 or 2^64 if size is a power of 2.
Maybe I don't understand it all, but with fons
approach I think it only works
when the buffer-sizes are 2^n. When you have a buffer of say 5 elements, doing
the modulo at the element-access and not at the read/write-head-movement, this
will jump every now and then, right?
It works only if the size is a divider of the int size, so
it must be a power of 2. But that is the case for Jack's
implementation as well (or anything that uses 'n & (size-1)'
instead of 'n % size'.
Ciao,
--
FA