[erlang-questions] docs on group leaders?

Xavier Noria fxn@REDACTED
Thu Apr 5 00:26:41 CEST 2018

Awesome Fred!!!

I was precisely right now thinking about that grouping usage, since
application_controller.erl has code like

    ets:match(ac_tab, {{application_master, '$1'}, Master})

used by application.erl as in


which is like grepping based on the group leader. I think I read about this
trick somewhere, but has checked several of the resources I normally
consult and have failed to find it. Perhaps it was that code comment you

The strange thing for someone like me studying this is that this use case
seems unrelated to I/O, it is like hijacking the idea of group leader for
something entirely different, so your confirmation helps.

Indeed, application masters seem to be just delegating to their previous
group leader since it seems all I/O messages get forwarded up as in

     IoReq when element(1, IoReq) =:= io_request ->
        State#state.gleader ! IoReq,

Also, if some subtree of the application changed the group leader, that
grouping trick wouldn't work. Since the trick is in place in such a core
module, I guess the conclusion is that you are generally not supposed to do
that unless you know very well what you are doing.

José Valim also explained to me the use case of shells a while back.

Thanks a lot Fred!!!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20180405/f6d40775/attachment.htm>

More information about the erlang-questions mailing list