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

Making sure client_base instance that registered the component does not unregister it when being destructed #2976

Merged
merged 1 commit into from Oct 29, 2017

Conversation

hkaiser
Copy link
Member

@hkaiser hkaiser commented Oct 26, 2017

@Hapoo please verify whether this fixes your problem

@akheir
Copy link
Member

akheir commented Oct 26, 2017

Thanks, my problem solved.

Copy link
Member

@sithhell sithhell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general I'm not a big fan of the solution. It brings the shared state of futures, GIDs and symbolic names together in a non obvious way.

HPX_ASSERT(registered_name_.empty()); // call only once
registered_name_ = name;
if (manage_lifetime)
hpx::agas::register_name(launch::sync, name, id);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The shared state should hold the id we want to register the name, right? Why do we need to pass in another one?

Copy link
Member Author

@hkaiser hkaiser Oct 26, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that could be done, indeed.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@@ -296,6 +297,20 @@ namespace detail
error_code& = throws) = 0;
virtual std::exception_ptr get_exception_ptr() const = 0;

virtual std::string const& get_registered_name() const
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this really required to be part of the abstract base? We only need it for the id_type specialization, right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's only needed for that. The alternative is to upcast the shared state - which I'd like to avoid.

@hkaiser
Copy link
Member Author

hkaiser commented Oct 26, 2017

In general I'm not a big fan of the solution. It brings the shared state of futures, GIDs and symbolic names together in a non obvious way.

Any suggestion on how to solve this otherwise?

@hkaiser hkaiser merged commit c6406e6 into master Oct 29, 2017
@hkaiser hkaiser deleted the client_base_registration branch October 29, 2017 18:28
@sithhell
Copy link
Member

I think the change to future_base was unnecessary. If I'm not completely mistaken, it would have been more then enough if client_base got it's own special shared state. No upcasting or dowancasting needed since the type is known in the context of name registration. Otherwise you'd need an extra check of some kind anyway to avoid the exception that the virtual function is not implemented. The merge was a little too hasty, IMHO.

@hkaiser
Copy link
Member Author

hkaiser commented Oct 29, 2017

@sithhell No, a special (and independent) shared state wouldn't have been enough. We need for client_base<> to be directly constructible from a future<id_type> (in fact, client_base is nothing but a special version of a future<id_type>). While this could be done still if those had independent shared states, it would require additional unwrapping etc. to make it happen (that's what I wanted to avoid).

The current solution creates a 'special shared state' but it does so in a way that still keeps it compatible with the shared state of future<id_type>.

@sithhell
Copy link
Member

sithhell commented Nov 1, 2017 via email

@hkaiser
Copy link
Member Author

hkaiser commented Nov 1, 2017

Yes, it would require special unwrapping. I would not consider that a deal breaker though.

I'd consider this to be a deal-breaker.

The code as it is suspect to odr violations. Not all TUs that use future<id_type> include the client_base header.

Those compilation units wouldn't compile.

But overall, please feel free to come up with a different solution.

@sithhell
Copy link
Member

sithhell commented Nov 1, 2017 via email

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

3 participants