420 questions
2 votes
1 answer
210 views
What's wrong with this thread-safe circular buffer?
I am playing with a toy circular buffer where MT involves: #include <stdio.h> #include <stdlib.h> #include <pthread.h> #include <semaphore.h> #define N 8 int *arr; int ...
1 vote
3 answers
85 views
How do I update an address with a constant minus an address in a circular buffer
I have pointer into a delay line that I wish to update. If the pointer (p) goes past the end of the buffer, I wish to wrap around to the start plus some value. _Complex float buffer[BUF_LEN]; ...
0 votes
1 answer
133 views
Read from circular FIFO(Buffer) in C language [closed]
I have a hardware that writes input data to an address by hardware The base address or starting circular FIFO is similar to this address 0xc6dc9cf0 Buffer(FIFO) Baseaddress and has a register for ...
-1 votes
1 answer
141 views
uint_MAX wrap around: can I trust it for ringbuffer head and tail?
I have a ringbuffer that stores head and tail index as an unsigned integer value. According to this source it is enough to only wrap at retrieval of the indices and just let the uint behaviour take ...
1 vote
1 answer
744 views
Byte Buffer Ring Buffer type in ESP32
This is my first attempt to use a ring buffer. In my project, I receive data through a loRa module (the Reyax RYLR998 specifically) and push every message I receive to the ring buffer. I defined a ...
1 vote
1 answer
719 views
How to implement a ring buffer safely in shared memory safely when the consumer is operating in real-time context
My situation is this: On a Linux machine I have a shared-memory region inside which lives a ring-buffer of audio samples. This ring-buffer's consumer is a hard-real-time Xenomai audio-callback, so ...
0 votes
0 answers
100 views
Segmentation Fault with Circular Buffer Implemenation
I am implementing a circular buffer but I am getting a confusing segmentation fault when I am testing my implementation. The code seems to produce a segfault right after I call a function to print out ...
1 vote
0 answers
326 views
How to wrap around a ring buffer?
I am trying to implement a ring buffer in C to an external flash memory. For reference the flash memory is BR24G32-3 with 4kb. I am having difficulties when it comes to the wrap around. After writing ...
0 votes
1 answer
114 views
How to wait for all Disruptor messages to be consumed in a test case
I'm trying to unit test an application which publishes/consumes messages using the Disruptor ring buffer. In the test I would like to Configure the Disruptor and it's EventHandlers Publish messages ...
1 vote
1 answer
960 views
==284==ERROR: AddressSanitizer: stack-buffer-underflow
I am writing a more simple version of the Boyer Moore algorithm, and I need to use circular buffer because there could be a really big input. The program should write all positions of symbols which ...
1 vote
1 answer
552 views
Use of volatile in circular buffers with interrupts
I am struggling with the correct use of the volatile keyword when implementing a circular buffer. The buffer is written in an ISR and read in the main program. I am running a bare-metal ...
20 votes
1 answer
18k views
Why is the circular buffer not standardized in C++?
I want to know the history of the standardization of the circular buffer(circular queue or deque). AFAIK, the current C++ standard(C++ 2023) doesn't provide a circular buffer in the STL. I googled and ...
2 votes
1 answer
940 views
How to safely overwrite data in a full circular_buffer in C++
I currently try to wrap my head around how to safely handle the case that a circular buffer is full and the producer wants to insert data into it. The reason is that I have a classic producer-consumer ...
0 votes
1 answer
79 views
How to speed up data imports from ring buffers in a java client?
We have a third party application producing data at a very high speed and storing it in multiple ring buffers (hazelcast cluster). The consumer application (another third party app) uses this java ...
0 votes
0 answers
317 views
Ring buffers of android logcat
The result of data below is from "adb logcat -d -b V:*". As I know, each of ring buffers - 'main, system, crash, events, radio is separate. But as you can see, log data is continuous. How ...