In HPX introduction tutorials you learn that you can make use of future's then() method, that allows you to enqueue some operation to be computed when the future is ready.
In this manual there is a sentence that says "Used to build up dataflow DAGs (directed acyclic graphs)" when explaining how to use thens.
My question is, what does it mean that this queue has to be acyclic? Can I make a function that re-computes a future inside a then? This would look like myfuture.then( recompute myfuture ; myfuture.then() ) ?
You can think of a
hpx::future(very similar, if not identical tostd::experimental::future, see https://en.cppreference.com/w/cpp/experimental/future) is an one-shot pipeline between an anonymous producer and a consumer. It does not represent the task itself but just the produced result (that might not have been computed yet).Thus 'recomputing' a future (as you put it) can only mean to reinitialize the future from an asynchronous provider (
hpx::async,future<>::then, etc.).I'm not sure if this answers your question and why you would like to do that, but here you go.