locked_sstream is a tiny C++ library which wraps std::stringstream in a mutex to attempt to fix crashes on OS X when multiple threads simultaneously use different stringstreams. It remains to be seen whether it fixes the problem completely, but it certainly helps.