What happens to a detached thread when main() exits?
问题 Assume I\'m starting a std::thread and then detach() it, so the thread continues executing even though the std::thread that once represented it, goes out of scope. Assume further that the program does not have a reliable protocol for joining the detached thread 1 , so the detached thread still runs when main() exits. I cannot find anything in the standard (more precisely, in the N3797 C++14 draft), which describes what should happen, neither 1.10 nor 30.3 contain pertinent wording. 1 Another,