
Ein Held wrote:
{ std::ifstream instream(file_name); file = std::string(std::istreambuf_iterator<char>(instream.rdbuf()),std::istreambuf_iterator<char>()); instream.close();
for(int i=0;i<10;++i) { boost::thread t(test); }
test(); }
I assume you are using the latest Boost. At a quick glance, it seems that it is possible for one of your 10 threads to still be running when the main program exits. I wonder if this is the problem. You might want to use thread_group and join_all to make sure. Specifically: for(...) { // destructor calls detach() -> thread keeps running boost::thread t(test); } test(); // possible to finish before one of the above threads Try changing to: boost::thread_group group; for(...) { group.add_thread(new boost::thread(test)); } test(); group.join_all(); Good luck! -- Sohail Somani http://uint32t.blogspot.com