make sure std::thread::join() not throwing an exception