AlgoMaster Logo

Futures & Promises (std::future, std::promise)

Last Updated: May 17, 2026

11 min read

When one thread needs to hand a single value to another, building it from mutexes and condition variables is more work than it should be. std::future and std::promise are the higher-level pair the C++11 standard library adds for exactly this case: one thread produces a value (or an exception), and another thread waits for it. This chapter covers how the two ends connect, how exceptions cross the thread boundary, and when to use std::shared_future to fan a single result out to several consumers.

Premium Content

Subscribe to unlock full access to this content and more premium articles.