Replies: 3 comments
-
Actually, I just wanted to open another topic about the same potential problem. Reading through the code, I also have my doubts about that same statement in the documentation. The reason is that I am not suggesting to rewrite ring_buf, as there already is a lock free ring buffer implementation, which I would always recommend to use in situations like this. However, the misleading sentence should perhaps be removed from the documentation, pointing people to spsc_lockfree instead. |
Beta Was this translation helpful? Give feedback.
-
I agree with your observation.
In my opinion, that last sentence of the "concurrency" paragraph is misleading. While it is true that on some architecture/compiler combination no concurrency control might be needed for the trivial case one producer/one consumer, But I don't think we can really rely on it (to be sure, we have to check the produced assembly code). Perhaps it would be simpler to remove that last sentence. Please report an issue against the documentation. Happy to take care of it, if you want to. |
Beta Was this translation helpful? Give feedback.
-
There's already an open issue on the topic: Issue 69403. |
Beta Was this translation helpful? Give feedback.
-
Hi,
there is this sentence in the zephyr ring buffer docs
I have a simple case where data received over UART are filled into a ring buffer
using ring_buf_put_claim()
in an interrupt routine. Then there is a single thread which periodically access the data withring_buf_get_claim()
. I see very rare occurrences when the received data are wrong. After some time I have started to be suspicious about the ring buffer concurrency issue. Can it be the case here? Shouldn't I doring_buf_get_claim()
inside a critical section?best regards
Jan
Beta Was this translation helpful? Give feedback.
All reactions