#include #include #include #include #include struct read_t { read_t(const std::string &_js) : js(_js) { } void operator()() const { std::istringstream ijs; while (true) { ijs.str(js); boost::property_tree::ptree pt; boost::property_tree::read_json(ijs, pt); std::cout << "." << std::flush; } } const std::string js; }; int main() { const std::string js = "\ {\ \"glossary\":{\ \"title\":\"example glossary\",\ \"GlossDiv\":{\ \"title\":\"S\",\ \"GlossList\":{\ \"GlossEntry\":{\ \"ID\":\"SGML\",\ \"SortAs\":\"SGML\",\ \"GlossTerm\":\"Standard Generalized Markup Language\",\ \"Acronym\":\"SGML\",\ \"Abbrev\":\"ISO 8879:1986\",\ \"GlossDef\":{\ \"para\":\"A meta-markup language.\",\ \"GlossSeeAlso\":[\ \"GML\",\ \"XML\"\ ]\ },\ \"GlossSee\":\"markup\"\ }\ }\ }\ }\ }\ "; boost::thread t1((read_t(js))); boost::thread t2((read_t(js))); // comment out this line and the program runs fine t1.join(); // never stop return 0; }