I\'ve known for a while that GCC uses COW (Copy-On-Write) for std::string
, making it impossible to use std::string
in a multi-threaded program. Bu
If you're going to pass a string across a thread boundary, do an explicit copy, in order to force it to be an independent string, then pass that across:
std::string a="bob";
std::string b(a.data(), a.length());
It's annoying to have to do this at all spots where things cross threads, but in my opinion it's easier than vector<char>
.