The async
call below is blocking because the destructor of the returned future is blocking:
void foo() {}
void foo_async() {
std::async(std::launch::async, foo);
}
But I don't want to block!
I'm considering to use the following workaround:
void foo_async() {
std::thread(foo).detach();
}
Is this ok? Or would you recommend a different solution?
See Question&Answers more detail:os