Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Properly handle deferred futures #1506

Closed
hkaiser opened this issue May 12, 2015 · 5 comments
Closed

Properly handle deferred futures #1506

hkaiser opened this issue May 12, 2015 · 5 comments

Comments

@hkaiser
Copy link
Member

hkaiser commented May 12, 2015

Currently, most of our facilities (wait_xxx, when_xxx, dataflow) do not properly handle deferred futures.

@hkaiser hkaiser added this to the 0.9.11 milestone May 12, 2015
K-ballo added a commit to K-ballo/hpx that referenced this issue May 18, 2015
K-ballo added a commit that referenced this issue May 19, 2015
Properly handle deferred futures, fixes #1506
@hkaiser
Copy link
Member Author

hkaiser commented May 20, 2015

I think we need to execute the function associated with a deferred future, if the future is about to be destroyed and the value has not been retrieved. If this is not done, the associated function might never be executed.

@hkaiser hkaiser reopened this May 20, 2015
@K-ballo
Copy link
Member

K-ballo commented May 20, 2015

The current implementation reflects what the standard mandates. This enables lazy evaluation, where unnecessary computations are not evaluated at all. We may want to differ from the standard here (we already do for launch::async, and the rationale for introducing launch::deferred does not apply to us either), but I think that deserves it's own issue.

@hkaiser
Copy link
Member Author

hkaiser commented May 20, 2015

Yah, by letting a future returned from async block if needed the standard implies this behavior for deferred futures as well. There was simply no need to add a special clause for launch::deferred as the general clause already covers the required behavior for deferred futures.

In our case however, we need special handling for deferred futures as otherwise the function associated with those might never execute.

@K-ballo
Copy link
Member

K-ballo commented May 20, 2015

That's not what I said, the blocking from futures applies to launch::async only. See: http://melpon.org/wandbox/permlink/cpMhTfbFu7lAs3FX

@hkaiser
Copy link
Member Author

hkaiser commented May 20, 2015

Well, let's close this issue and discuss it separately.

@hkaiser hkaiser closed this as completed May 20, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants