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
Šimon Tóth’s Post
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development