FOMO Daily
Feed
Raymond Chenยท

C++ futures part 1: The mental model

Languages & ToolingC++FuturesConcurrency

TL;DR

C++ promises, futures, and related utilities are easier to understand as wrappers around a shared state that holds either a value or an exception. Chen sketches that state using a mutex and condition variable to coordinate setting a result once, waiting for it, and retrieving or consuming it. This provides a mental model for how the standard-library utilities fit together, with their construction left for the next installment.

Read the original post Sign in to mark as read or skip