30 Thread support library [thread]

30.3 Threads [thread.threads]

30.3.1 Class thread [thread.thread.class]

30.3.1.3 thread destructor [thread.thread.destr]

~thread();

If joinable(), calls std::terminate(). Otherwise, has no effects. [ Note: Either implicitly detaching or joining a joinable() thread in its destructor could result in difficult to debug correctness (for detach) or performance (for join) bugs encountered only when an exception is raised. Thus the programmer must ensure that the destructor is never executed while the thread is still joinable.  — end note ]