关于 abcast 函数和 gen_server 名称的唯一性的混淆
Confusion regarding abcast function and uniqueness of gen_server names
来自 erlang.org/doc,gen_server 部分:
start_link(ServerName, Module, Args, Options) -> Result
If there already exists a process with the specified ServerName
the function returns {error,{already_started,Pid}}
显然,Erlang 不允许多个进程具有相同的名称。
好,现在我们来看another function:
abcast(Name, Request) -> abcast
Sends an asynchronous request to the gen_servers locally registered as Name
at the specified nodes.
注意复数形式的使用。
既然 Erlang 需要 gen_server 进程的唯一名称,为什么 abcast
函数会实现异步消息发送到 多个 具有相同名称的进程?
我错过了什么?
Sends an asynchronous request to the gen_servers locally registered as Name at the specified nodes.
您可以有多个节点,进程注册为 名称。
来自 erlang.org/doc,gen_server 部分:
start_link(ServerName, Module, Args, Options) -> Result
If there already exists a process with the specified
ServerName
the function returns {error,{already_started,Pid}}
显然,Erlang 不允许多个进程具有相同的名称。
好,现在我们来看another function:
abcast(Name, Request) -> abcast
Sends an asynchronous request to the gen_servers locally registered as
Name
at the specified nodes.
注意复数形式的使用。
既然 Erlang 需要 gen_server 进程的唯一名称,为什么 abcast
函数会实现异步消息发送到 多个 具有相同名称的进程?
我错过了什么?
Sends an asynchronous request to the gen_servers locally registered as Name at the specified nodes.
您可以有多个节点,进程注册为 名称。