Skip to content

Am I right that queue is implemented as a circular buffer? Why is there a dedicated circular buffer then? #526

Closed Answered by jwellbelove
positron96 asked this question in Q&A
Discussion options

You must be logged in to vote

All of the queues were created long before etl::circular_buffer and therefore got multiple variants. There is a fundamental difference between the queues and the circular buffer in that when a queue becomes full, that's it. No more data can be pushed until an item is pulled.
By contrast, the circular buffer will just over-write old data with new as the input pointer loops round. Circular buffers are usually used in low level interrupt code and protected by interrupt enable/disable code.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@positron96
Comment options

Answer selected by positron96
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants