Thread safe double linked list
I nead a linked list, that can be safely accessed by more then one threads. I want to be able to add, delete and move elements in the list. I also want to be able to have something like objects that act like iterators, pointing to elements of the list. I want those iterators to be able to move forward and backward and may stay on and element for a long time. The list must protect these elements from deletion or moving (you can't move or delete element while there are iterators on it). I want it all to be as efficient as possible. For more then a week I've tried many things, but this is very very complicated. Has anyone ever met the need to have a good linked list in a multithreading environment? I really hope that someone has a solution, because it seems this situation is too complicated for my brain.