3 ms·
What if a background thread deletes a node from the list while the iterator is running? From the cpp reference: "Concurrently accessing or modifying other elem
by Aeolos 11y ago
What if a background thread deletes a node from the list while the iterator is running?
From the cpp reference: "Concurrently accessing or modifying other elements is safe, although iterating through the container is not."
That's the problem with multithreaded code. You can't just see a read loop in isolation and say "this is thread-safe" - it's not.