+ 1
Detach thread exception
Do process terminate even if a thread detached (not joined) has an exception? Ideally it should not be. Right?
3 odpowiedzi
+ 2
Hi Ketan,
I think the behaviour is undefined, but in most implementations if a detached thread throws an exception, the whole process might actually terminate, which isn't ideal. This happens because if an exception isn't caught within the thread, it will propagate in the call stack and eventually call std::terminate(), which by default calls abord(), killing the entire process.
+ 2
In practice, the thing (to have a detached thread throw an exception and let the process continue normally) isn't something you can count on.
+ 1
Thanks Amine Laaboudi