> I have just started using HPX in a project and while discussing this
> with colleagues a question came up:
> 
> Given a task tree, is it possible to delay the execution of the tasks
> until it is certain that the end-result is required (for example,
> because it is written to disk)?
> 
> In my project, it is possible that parts of the task tree don't need to
> be executed. This decision can only be made at run time, after a part of
> the task tree has already been created.
> 
> I can imagine that somehow executing tasks can be delayed until
> future.get() is called, for example.

A future which was created as deferred will be executed only if future::get
is called:

    hpx::future<T> f = hpx::async(hpx::launch::deferred, []() {...});
    //...
    f.get(); // <-- this triggers the execution of the lambda.

FWIW, you can also pass the deferred launch policy to dataflow and
future::then, if needed.

HTH
Regards Hartmut
---------------
http://boost-spirit.com
http://stellar.cct.lsu.edu



_______________________________________________
hpx-users mailing list
hpx-users@stellar.cct.lsu.edu
https://mail.cct.lsu.edu/mailman/listinfo/hpx-users

Reply via email to