It would be nice to have an example use case where the technique would show a benefit.
It seems relatively rare to have a single producer and consumer thread, and be worth polling a ring buffer.
It would be nice to have an example use case where the technique would show a benefit.
It seems relatively rare to have a single producer and consumer thread, and be worth polling a ring buffer.
I use my own very similar version of this spsc lock-free ring buffer on almost every embedded project I work on that has to stream any sort of sampled data (e.g. audio). You can even have the consumer end be a DMA into something like a uart or USB peripheral so your microcontroller userspace doesn't have to touch the hardware.