Easy
A std::thread destroyed without join or detach
run() creates a std::thread and returns without joining or detaching it. What happens when this program runs?
main.cpp
void doWork() {
std::this_thread::sleep_for(std::chrono::milliseconds(50));
}
void run() {
std::thread t(doWork);
// no t.join() and no t.detach() here
}
int main() {
run();
std::cout << "done" << std::endl;
}14 of 51 in Concurrency