Use std::async to manage thread