Tasks
In addition to threads, C++ has tasks to perform work asynchronously. Tasks need the <future>
header. A task is parameterised with a work package, and consists of the two associated components: a promise and a future. Both are connected via a data channel. The promise executes the work packages and puts the result in the data channel; the associated future picks up the result. Both communication endpoints can run in separate threads. It is special that the future can pick up the result at a later time; therefore, the calculation of the result by the promise is independent of the query of the result by the associated future.