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

question about make_sup_name in cxy_foun_sup #73

Open
benoitc opened this issue Oct 18, 2016 · 1 comment
Open

question about make_sup_name in cxy_foun_sup #73

benoitc opened this issue Oct 18, 2016 · 1 comment

Comments

@benoitc
Copy link

benoitc commented Oct 18, 2016

Hi,

I found that the name was rewritten when starting a Fount by this function. What do you think about removing it? When it's here it requires more work to retrieve the sup using its name. Thoughts?

@jaynel
Copy link
Member

jaynel commented Oct 19, 2016

Not sure I follow your comment. When you do cxy_fount_sup:start_link and you supply a name, you are providing a name for the cxy_fount. I use FOUNT_NAME_sup as the name of the supervisor, FOUNT_NAME as the name of the cxy_fount gen_fsm.

I did it that way because the interface is to the cxy_fount. The only case for using the supervisor is to get the cxy_fount instance (when it has no name), or to get the cxy_regulator instance (which should be very rare). cxy_fount_sup:start_link returns {ok, Pid} so you can just use the Pid instead of the name. When in a supervisor hierarchy, it just gets wired in normally.

What are you doing that requires you to need the supervisor instance by name? If you do need it, I've just gone with the convention that for cxy_fount 'socket_fount' it is 'socket_fount_sup' (i.e., just append '_sup' on the end of your cxy_fount name to get the supervisor to kill it or something). Generally, I expected people naming the founts to just have hard-coded atoms in their code, so they will just hard-code xxxx_sup as well if they need to access it.

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

No branches or pull requests

2 participants