AbstractFIFO and 'amount actually read/written'?

From the lock of the example in the AbstractFIFO docs, it always tells the FIFO that it used all available slots. Is that wrong? Shouldn’t it be just the slots that were actually used? In my version, I’ve been saying how much I actually wrote - is that wrong?


[code]void addToFifo (const int* someData, int numItems)
int start1, size1, start2, size2;
prepareToWrite (numItems, start1, size1, start2, size2);

        if (size1 > 0)
            copySomeData (myBuffer + start1, someData, size1);

        if (size2 > 0)
            copySomeData (myBuffer + start2, someData + size1, size2);

        finishedWrite (size1 + size2);

EDIT: in my case, if there was room for my one item, I end up doing finishedWrite (1);

A: it’s an efficiency. Since prepareToWrite will only return numItems or less, then written will be size1 + size2 in the example.

Yeah, you can write as much or as little as you want to - in the example I make it fill as much space as is available, but you don’t have to do that.