我有一个简单的主管配置:
-module(my_supervisor).
-behaviour(supervisor).
-export([start_link/0, init/1]).
init(_Args) ->
{ok, { {one_for_one, 5, 10},
[
{my_worker, {my_worker, start_link, []}, permanent, 5000, worker, [my_worker]}
]
}
}.
甚至是简单的工人:
-module(my_worker).
-export([start_link/0]).
start_link() ->
%??? is this the first time the supervisor is starting me or have I crashed and been restarted???
那么是否有可能确定这是主管第一次调用 start_link 函数,还是工作进程在过去某个时间崩溃并且现在正在重新启动?