I am wondering why a function doWork() is called without the upper code being exectued. The code is the following:
void doWork()
{
std::cout<<"Hello World>";
sleep(1);
doWork();
}
....
void foo()
{
std:cout<<"This is text is never seen in the console but doWork timer callback works";
std::thread thread([&]{doWork();});
}
Why is std:cout not working but std::thread is being executed?
Thanks