The C++11 standard library introducedstd::async
as a convenient means of asynchronously executing a function on a new thread and returning an instance of astd::future
representing the eventual result produced by that function. In HPX, thehpx::async
API is one of the most basic parallelization facilities exposed to the user. Here is a simple example of how it can be used: