gpt4 book ai didi

erlang - Supervisor :start_child come from? 的 Info 返回值 {ok, Child, Info} 在哪里

转载 作者:行者123 更新时间:2023-12-01 12:49:41 30 4
gpt4 key购买 nike

我从 Erlang 文档中看到 supervisor:start_child 可以返回两个不同的非错误结果:{ok, Child} 和 {ok, Child, Info}。这个信息在哪里设置? simple_one_for_one sups 与其他 sups 有什么不同吗?我一直无法找到关于此的示例/文档...

最佳答案

Info 来自启动子进程的函数(在主管的子规范中给出)。大多数时候,该函数最终会调用 gen_server:start_link/4。它只返回 {ok, Pid} 而从不返回 {ok, Pid, Info},所以这种情况只适用于你有一个自定义函数来产生进程,可能使用the proc_lib module 中的函数.

不使用预定义行为的进程称为“特殊进程”并且是 described in the OTP Design Principles User's Guide .

关于erlang - Supervisor :start_child come from? 的 Info 返回值 {ok, Child, Info} 在哪里,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13451588/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com