I read a lot of posts here with the question if the standard containers for C++ (like "list" or "map" are thread safe and all of them said that it is not in general. Parallel reads should be OK, but parallel writes or parallel reads and writes may cause problems.
Now I found out that at www.cplusplus.com that accessing or modifying the list during most of the operations is safe.
Some examples:
The container is accessed (neither the const nor the non-const versions modify the container). No mapped values are accessed: concurrently accessing or modifying elements is safe.
The container is modified. Concurrently accessing existing elements is safe, although iterating ranges in the container is not.
Do I missunderstand cplusplus.com or is there anything else what I have to know about thread safety in std containers.
Thanks in advance!
PS: I'm asking for C++03 and not for C++11
See Question&Answers more detail:os