#include<thread>
#include<iostream>
using namespace std;
void hello()
{
cout<<"Hello World\n";
}
int main()
{
thread t(hello);
t.join();
}
When I comment t.join() ,
I get an error
terminate called without an active exception Aborted (core dumped)
But why do main has to wait for the child to complete? Doesn't the hello thread have its' own independence?
Aucun commentaire:
Enregistrer un commentaire