Preventing thread from calling std::terminate() on detach after handled exception
问题 I have my own thread class that is intended to help safely manage exceptions. It looks like this: (skipped other constructors and mutexes for simplicity) class ExceptThread : public std::thread { public: template<typename Func, typename... Args> ExceptThread(Func&& f, Args&&... args) : std::thread([] (Args&&... args) { try { return f(args...); } catch(...) { exc = std::current_exception(); } }, args...) { } // skipped other constructors etc. //... void check() { if(exc) { std::exception_ptr