diff options
| -rw-r--r-- | include/gm_specs.hrl | 2 | ||||
| -rw-r--r-- | src/gm.erl | 14 |
2 files changed, 15 insertions, 1 deletions
diff --git a/include/gm_specs.hrl b/include/gm_specs.hrl index 987866db38..2109d15d22 100644 --- a/include/gm_specs.hrl +++ b/include/gm_specs.hrl @@ -16,7 +16,7 @@ -ifdef(use_specs). --type(callback_result() :: 'ok' | {'stop', any()}). +-type(callback_result() :: 'ok' | {'stop', any()} | {'become', atom(), args()}). -type(args() :: [any()]). -type(members() :: [pid()]). diff --git a/src/gm.erl b/src/gm.erl index 8fea919667..283b243171 100644 --- a/src/gm.erl +++ b/src/gm.erl @@ -432,6 +432,20 @@ behaviour_info(callbacks) -> [ + %% The joined, members_changed and handle_msg callbacks can all + %% return any of the following terms: + %% + %% 'ok' - the callback function returns normally + %% + %% {'stop', Reason} - the callback indicates the member should + %% stop with reason Reason and should leave the group. + %% + %% {'become', Module, Args} - the callback indicates that the + %% callback module should be changed to Module and that the + %% callback functions should now be passed the arguments + %% Args. This allows the callback module to be dynamically + %% changed. + %% Called when we've successfully joined the group. Supplied with %% Args provided in start_link, plus current group members. {joined, 2}, |
