https://blog.csdn.net/hzhsan/article/details/50377508
spawn(Fun) -> pid()
參數類型:
Fun = function() %% 參數為空的函數
返回類型:進程Pid
說明:生成一個由Fun函數啟動的、參數為空的新進程,并返回進程的Pid。spawn(Node, Fun) -> pid()
參數類型:
Node = node() %% 節點
Fun = function() %% 參數為空的函數
返回類型:進程Pid
說明:生成一個由在Node節點上,由Fun函數啟動的、參數為空的新進程,并返回進程的Pid。
spawn(Module, Function, Args) -> pid()
參數類型:
Module = module() %% 模塊名
Function = atom() %% 原子函數名
Args = [term()] %% 參數列表
返回類型:進程Pid
說明:生成一個由Module:Function函數啟動的、參數為Args列表的新進程,并返回進程的Pid。
新的進程會被放入系統的調度隊列之中,延后創建。
error_handler:undefined_function(Module, Function, Args) is evaluated by the new process if Module:Function/Aritydoes not exist (where Arity is the length of Args). The error handler can be redefined (see process_flag/2). If error_handler is undefined, or the user has redefined the default error_handler its replacement is undefined, a failure with the reason undef will occur.
> spawn(speed, regulator, [high_speed, thin_cut]). <0.13.1>
spawn(Node, Module, Function, Args) -> pid()
Types:
Node = node()
Module = module()
Function = atom()
Args = [term()]
返回類型:進程Pid
說明:生成一個在Node節點上,由Module:Function啟動的、參數為Args列表的新進程,并返回進程的Pid。
如果Node不存在,會返回一個沒用的pid。其他情況和spawn/3一樣。
hzhsan注:函數不等于函數的返回值。參數是表達式,如果這個表達式的結果應該是個函數,那么就不能是函數的返回值。
posted on 2018-04-10 14:27
思月行云 閱讀(768)
評論(0) 編輯 收藏 引用 所屬分類:
Erlang