I have two questions about STL
1) why STL is not thread-safe? Is there any structure that is thread-safe?
2) How to debug STL using GDB? In GDB, how can I p
The standard c++ containers are not thread safe because you most likely actually want higher level locking than just the containers themselves. In other words you are likely to want two or more operations to be safe together.
For example, if you have multiple threads running:
v.push_back(0);
v.push_back(1);
You wont get a nice vector of alternating 0's and 1's, they could be jumbled. You would need to lock around both commands to get what you want.