Better HN
topnewbestaskshowjobs
Log inSign up

mdocc

1 karma · joined Mar 10, 2026 (8mo ago) · 1 submissions

Submissions

comment 8mo ago · link · parent

>StaticQueue: LinearisedIterator

Using C++ iterator interface to fix the main problem of a standard ring buffer of non-contiguous regions is a cute idea, but I like to use a "bip buffer"[1] instead which actually always gives you real contiguous regions so you can pass the pointers to things like a dma engine.

[1] https://ferrous-systems.com/blog/lock-free-ring-buffer/

The tradeoff is that you have in the worse case only half the buffer available - the ring buffer essentially becomes a kind of double buffer where you periodically switch between writing/reading at the end or the beginning of the storage.