Am I right that queue is implemented as a circular buffer? Why is there a dedicated circular buffer then? #526
-
Given that etl queue is of fixed size, it might be reasonable to implement it as a circular buffer anyway. A quick glance at the code shows that is uses fixed-size buffer and read/write pointers inside that buffer, so it seems to me that it is a circular buffer under the hood. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
All of the queues were created long before |
Beta Was this translation helpful? Give feedback.
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.