C++ futures part 1: The mental model
cppdashboard.dev/r/2026/10/cpp-futures-part-1-the-mental-modelThis article discusses the C++ standard library's related functions and classes for futures, including std::promise, std::async, and std::future. It introduces the concept of a 'source' that produces values and handles exceptions in a thread-safe manner.
From the article
The C++ standard library has a group of related functions and classes: std::promise , std::packaged_task , std::async , std::future , and std::shared future .
The idea is that all of these classes are built of a single unnamed class which the C++ standard library calls the “state”, but for the purpose of discussion, I’m going to call it the source , since it is the thing that produces the value, and it behaves analogously to a C# task completion source.
The source conceptually supports these operations:
Share this resource