Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Peek for spsc and mpmc queue #23

Open
GMellar opened this issue Oct 30, 2024 · 1 comment
Open

Peek for spsc and mpmc queue #23

GMellar opened this issue Oct 30, 2024 · 1 comment

Comments

@GMellar
Copy link

GMellar commented Oct 30, 2024

In my use case I use the mpmc queue on an STM32 where I write data from SPI to TCP. SPI is received by using DMA and the completion interrupt. MPMC is needed because there are some pushes from non interrupt routines. In the ring buffer there is the Peek() method.

TCP might fail if there is not enough space in the transmission buffer bit I don't know that before I consume the data from the buffer. At the moment the data is lost but in the future I would like to implement a peek method. Are there any plans at the moment to implement that?

@DNedic
Copy link
Owner

DNedic commented Oct 31, 2024

Good question! Personally, I am not aware of any way to do peeks, because it's not possible to guarantee that no reads will happen on different threads while peeking, messing with the monotonic counter. Perhaps if we can get the monotonic counter at the moment from Peek() and feed it to Skip() later, this could work.

I unfortunately don't have the time to implement this at the moment even if its possible, but any contributions are welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants