I gave you great information on how to make your queues thread safe again.
I don't know where this expectation comes from that you can reply to me and I can't reply to you. If you don't want to continue you don't have to reply.
This is totally irrelevant because if you paid attention, the problem wasn't even threads. It was concurrency, more abstractly. Iterator invalidation based on the "manifested" order of execution.
This is really just mixing terms. You aren't going to notice all your concurrency bugs without threads. If you're holding a raw pointer to an internal resource of a data structure while other threads can modify it, you aren't going to see all your bugs until multiple threads are modifying and reading from the queue.
If the threads have unpredictable lifetimes, then yes, some form of reference counting is indicated.
It isn't about threads having unpredictable lifetimes, they could all be running at the same time and have predictable lifetimes.
In some cases your data structures might even be so messy that you end up with cycles.
Then don't do that.
Thanks for the pointers to what is probably 5K lines of C++ boilerplate.
Lots of people get a lot of good out of them.
But I have written half a dozen concurrent queues myself,
You might want to benchmark and test those bad boys thoroughly if you think you can hold a raw pointer into a data structure that can change from other threads. If you use a template you won't have to rewrite them over and over.
Also don't forget that allocations can lock and that your double allocations of the struct and data in a data structure can amplify that.
If you want an approachable source that leaves out the fluff,
Thanks, but I haven't made the same assumptions about raw pointers in concurrent data structures then blamed the STL, so I haven't had the bugs that you're talking about here.