async: Fire and Forget

This lesson gives an overview of fire and forget used with std::async in C++ for multithreading.

Fire and forget futures are special futures; they execute just in place because their future is not bound to a variable. For a “fire and forget” future, it is necessary that the promise runs in a separate thread so it can immediately start its work. This is done by the std::launch::async policy.

Let’s compare an ordinary future with a fire and forget future.

Get hands-on with 1000+ tech skills courses.