June 2018
Intermediate to advanced
348 pages
8h 45m
English
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 ...