Skip to Content
C++ Reactive Programming
book

C++ Reactive Programming

by Praseed Pai, Peter Abraham
June 2018
Intermediate to advanced
348 pages
8h 45m
English
Packt Publishing
Content preview from C++ Reactive Programming

Future and promise

The C++ tasks often behave like a data channel of sorts. The sending end, often called promise, sends data to a receiving end, often called the future. The important notion about futures and promises is that they enable a transfer of values between two tasks without the explicit use of a lock. The transfer of values is handled by the system (runtime) itself. The basic concept behind future and promise is simple; when a task wants to pass a value into another, it puts the value into a promise.

A standard library makes sure that the future associated with this promise gets this value. The other task can read this value from this future (the following diagram has to be read from the right to the left):

The future comes ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Functional Programming in C++

Functional Programming in C++

Ivan Cukic

Publisher Resources

ISBN: 9781788629775Supplemental Content