Thread safe C++ linked list
The Linklist class is a variable lenght array implementing thread-safe operations.
- atomicity of all insert/remove and swap operations is insured by mutex locking (pthreads)
- the Entry class needs to be inherited by objects used in the linklist
Compared to other implementations as the STL <vector> type and derivates this list is fairly simple and intuitive, not much code is needed to iterate over it and it can carry transparently other classes and data payloads, while keeping every operation atomical and therefore thread safe.
This class was born for the [http://muse.dyne.org MuSE] playlist implementation and is now a core component overall present in FreeJ (also represented in the parsed javascript language) where it handles lists of Layers, Effects and other serialized components. Multithreaded architectures don't risk any race condition while manipulating the linklist.
[http://muse.dyne.org/codedoc/classLinklist.php Linklist class documentation]
- Linklist header in FreeJ
- Linklist code in FreeJ