3 ms·
Depends how you use it. For buffering realtime data if latency is of chief concern then by all means, discard the old stuff. If the desired behavior is to block
by alfalfasprout 10y ago
Depends how you use it. For buffering realtime data if latency is of chief concern then by all means, discard the old stuff. If the desired behavior is to block when the queue is full, then you need to check for an overlap.
- loeg 10y agoIf you're overwriting old data you still need to check for overlap and advance the read index if you're overrunning old data.
- jessaustin 10y agoThanks, this is what I was missing, and seems right in general. I think the old ring buffers I'm remembering just decided that reading out-of-order was a fitting punishment for not reading often enough. After all there is a bit of a race for the read index here...