OTP文档表示,gen_server:start_monitor/4的签名是:
start_monitor(ServerName, Module, Args, Options) -> Result
OTP 23.0
Types
ServerName = {local,Name} | {global,GlobalName}
| {via,Module,ViaName}
Name = atom()
GlobalName = ViaName = term()
Module = atom()
Args = term()
Options = [Option]
Option = {debug,Dbgs} | {timeout,Time} | {hibernate_after,HibernateAfterTimeout} | {spawn_opt,SOpts}
Dbgs = [Dbg]
Dbg = trace | log | statistics | {log_to_file,FileName} | {install,{Func,FuncState}}
SOpts = [term()]
Result = {ok,{Pid,Mon}} | ignore | {error,Error}
Pid = pid()
Error = {already_started,Pid} | term()Mon是什么?医生们只是说:
"Mon是对为监视服务器而设置的监视器的引用“
现在我知道Mon是一个监视器,它监视它,但是它的类型是什么?
读到erlang.erl,我发现:
-type registered_name() :: atom().
-type registered_process_identifier() :: registered_name() | {registered_name(), node()}.
-type monitor_process_identifier() :: pid() | registered_process_identifier().Mon pid() | atom() | {atom(), node()}的类型也是如此
发布于 2021-09-10 10:50:49
Mon是监视器的引用:
monitor_return({{ok, Pid}, Mon}) when is_pid(Pid), is_reference(Mon) ->
%% Successful start_monitor()...
{ok, {Pid, Mon}};(代码为这里)
https://stackoverflow.com/questions/69129995
复制相似问题