Šimon Tóth’s Post

View profile for Šimon Tóth

C++ Educational Content Creator | 20 years of Software Engineering experience distilled into digestible daily posts

The std::promise and std::future are high-level synchronization tools that implement one-shot producer-consumer semantics. A producer can fill the state of a std::promise with either a value or an exception. A consumer holding a std::future associated with this std::promise can call get() to block until the shared state is available, at which point get() will either re-throw the exception or return the value. Note that the shared state can only be accessed once. std::future also supports timeout/deadline through the wait_for() and wait_until() methods. Compiler Explorer link: https://lnkd.in/eMQjH4uv #cpp #cplusplus #coding #programming #dailybiteofcpp

  • text

To view or add a comment, sign in

Explore content categories