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
Fixing shared_executor_test #1992
Conversation
hkaiser
commented
Feb 18, 2016
- flyby: adding missing typedef
- flyby: adding missing typedef
typename hpx::util::result_of< | ||
typename hpx::util::decay<F>::type() | ||
>::type | ||
>::type |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be rather done in the trait? Is it an error in general to return a reference from the passed function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried solving it in the trait, but was not able to do it there. If you have an idea how this could be formulated, I'd appreciate any ideas.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried solving it in the trait, but was not able to do it there. If you
have an idea how this could be formulated, I'd appreciate any ideas.
I am still trying to wrap my around why this is needed in the first place.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tampering with the result like this looks wrong to me. It will also make some valid corner cases ill-formed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree. Any suggestions on how to solve this? The patch here was just meant as a stop-gap measure to make tests pass. Any proper solution would be certainly preferred.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried solving it in the trait, but was not able to do it there. If you
have an idea how this could be formulated, I'd appreciate any ideas.I am still trying to wrap my around why this is needed in the first place.
shared_future<>::get()
returns a const&
to the result. This code extracts the result, passing it along, the shared_future itself however goes out of scope.
Intuitively I would expect
That might show (real) issues when |
That is exactly the problem we're seeing. The current code uses auto-returntype deduction which amounts to the same things as you suggested, causing the code to return a dangling reference to the user of |
I don't think that's the case, if |
Sure. The problem lies in how the trait emulates the synchronous execute:
which will - as you said - dangle the reference. Additionally, as you said in IRC, the |
The ugly hack presented here already prevents the use of move-only types, there's no way around that with Without knowing much about Wrapping the callable with |
- Also: fixed return types for executor::execute() functions - added feature test for experimental/optional - added explicit implementation of execute for distribution_policy_executor
0bc921a
to
af36acf
Compare
LGTM
|