LOFi list thread safe needed
Posted: Mon Dec 04, 2023 1:37 pm
For a project I need, among other things, a thread-safe variant of a
LOFI list.
So get the last element out and add the newest element at the end of the
list.
The whole thing must be thread-safe because I fill the list from one thread
and remove the oldest element (last) from another for editing.
Even more detailed:
Data packets arrive via the serial interface which I want to push into a list.
I want to process these data packets at another location.
The data packets are only about 20 bytes wide, so they may fit into an array.
Or just in a memory area, which I would have to create when adding an element
and delete it when removing the element.
I haven't found the right thing here in the forum yet.
A post from the user "IDLE" does not work either.
I also had a look at the normal linked list, but it doesn't seem to work that easily.
I look forward to great suggestions .
Before I forget, please don't use an API, must be multiplatform.
LOFI list.
So get the last element out and add the newest element at the end of the
list.
The whole thing must be thread-safe because I fill the list from one thread
and remove the oldest element (last) from another for editing.
Even more detailed:
Data packets arrive via the serial interface which I want to push into a list.
I want to process these data packets at another location.
The data packets are only about 20 bytes wide, so they may fit into an array.
Or just in a memory area, which I would have to create when adding an element
and delete it when removing the element.
I haven't found the right thing here in the forum yet.
A post from the user "IDLE" does not work either.
I also had a look at the normal linked list, but it doesn't seem to work that easily.
I look forward to great suggestions .
Before I forget, please don't use an API, must be multiplatform.