I have multithreads program that each thread will return a string and then it will store in a shared vector container. I wonder is it possible for a std::vector to handle this case or I have to use locks to protect it?
No. Barring a handful of methods, only const
methods are concurrency safe.
(those exceptions are iterator getting/index access methods)
If any thread does such non-const
access, no other thread may do any access at all.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments