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

Make sure promise::get_gid() can be called more than once #1535

Merged
merged 2 commits into from May 29, 2015

Conversation

hkaiser
Copy link
Member

@hkaiser hkaiser commented May 20, 2015

No description provided.

@hkaiser
Copy link
Member Author

hkaiser commented May 20, 2015

@Finomnis This should fix your problem, please verify

@hkaiser
Copy link
Member Author

hkaiser commented May 25, 2015

@Finomnis can this be merged now?

@Finomnis
Copy link
Contributor

Hey :) my work cluster is/was down, so I wasn't able to verify. But if the test succeeds, it should work :)

@hkaiser
Copy link
Member Author

hkaiser commented May 25, 2015

@Finomnis Please let us know once you've tested it.

@Finomnis
Copy link
Contributor

Confirmed. Fixed my problem.

hkaiser added a commit that referenced this pull request May 29, 2015
Make sure promise::get_gid() can be called more than once
@hkaiser hkaiser merged commit 87da09b into master May 29, 2015
@hkaiser hkaiser deleted the open_promise_for_hpxcl branch May 29, 2015 17:29
@Finomnis
Copy link
Contributor

I think we should revert this change. I can prove that there is no scenario where this would not cause an out-of-scope problem.
If someone needs to request a second id_type directly from a promise, this means that the first id_type he requested is out-of-reach for the person requesting it, and it can not be guaranteed that it did not get released yet.

example (pseudocode):

promise p;
function_one(p.get_gid());
function_two(p.get_gid()); // UNSAFE - function_one could have release its id_type already

this code can get re-arranged in different ways, but it always comes back to the problem that you need to keep a copy of the previous id_type to ensure that it does not get out of scope. like this:

promise p;
id_type id1 = p.get_gid();
function_one(id1);
id_type id2 = p.get_gid();
function_two(id2); // SAFE - id1 is still alive and ensures that agas did not delete the object yet

but this always leads to the scenario that the caller still has a copy of the id_type, which he can simply reuse instead of querying a new one:

promise p;
id_type id1 = p.get_gid();
function_one(id1);
function_two(id1); // SAFE

Therefore, I think we should revert this change as every single use-case it is actually needed does introduce a systematic error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants