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 thread safe needed
LOFi list thread safe needed
SPAMINATOR NR.1
Re: LOFi list thread safe needed
I fixed it
https://www.purebasic.fr/english/viewto ... fo#p377516
but maybe you could use this lock free ring buffer, much faster than using a mutex, and to think they even named it after you.
https://www.purebasic.fr/english/viewtopic.php?t=79172
https://www.purebasic.fr/english/viewto ... fo#p377516
but maybe you could use this lock free ring buffer, much faster than using a mutex, and to think they even named it after you.

https://www.purebasic.fr/english/viewtopic.php?t=79172
Re: LOFi list thread safe needed
thx @idle, i'm on it now.
i will post some stuff later
i will post some stuff later
SPAMINATOR NR.1
Re: LOFi list thread safe needed
Maybe my bad... I do not know "LOFI"
I know "FIFO" (the first input, is the first output). Queue concept.
And I know "LIFO" (the last input, is the first output). Stack concept.
What about "LOFI" ? Is it FIFO, or LIFO ?
I know "FIFO" (the first input, is the first output). Queue concept.
And I know "LIFO" (the last input, is the first output). Stack concept.
What about "LOFI" ? Is it FIFO, or LIFO ?
- Mindphazer
- Enthusiast
- Posts: 460
- Joined: Mon Sep 10, 2012 10:41 am
- Location: Savoie
Re: LOFi list thread safe needed
Last Out, First In
"Dernier sorti, premier rentré"
Le dernier élève sorti de la salle de Philo entrera en premier dans la salle de Maths
"Dernier sorti, premier rentré"
Le dernier élève sorti de la salle de Philo entrera en premier dans la salle de Maths
MacBook Pro 16" M4 Pro - 24 Gb - MacOS 15.4.1 - Iphone 15 Pro Max - iPad at home
...and unfortunately... Windows at work...
...and unfortunately... Windows at work...
Re: LOFi list thread safe needed
Okay, LOFI => LIFO
Just the "outdoor" and the "indoor" are swapped, LOFI is so a stack concept.
Just the "outdoor" and the "indoor" are swapped, LOFI is so a stack concept.