Dealing with data synchronization in multithreaded applications is hard, error-prone, and requires developers to write a lot of code to properly align data exchange and data notifications. In order to simplify development,  C++11 introduced a standard API for writing asynchronous code in a way that resembles regular synchronous function calls and hides lots of the synchronization complexities under the hood.
In this recipe, we will learn how to use asynchronous function invocations and futures to run our code in multiple threads with virtually no extra effort, for data synchronization.