在调用add_location
时似乎遇到了问题-module(test_sup).
-version(1.0).
-behaviour(supervisor).
-export([start_link/0,add_location/3]).
-export([init/1]).
-define(SERVER, ?MODULE).
start_link() ->
supervisor:start_link({local,?SERVER}, ?MODULE, no_args).
add_location(SupPid, Spaces, Occupied) ->
supervisor:start_child(SupPid, child(test_location, [Spaces, Occupied])).
init(no_args) ->
{ok, {{rest_for_one, 5, 2000}, []}}.
child(Module, Args) ->
{Module, {Module, start_link, Args},
permanent, brutal_kill, worker, [Module]}.
我打电话给....
{_, SupPid} = test_sup:start_link().
{Success, LocRef} = test_sup:add_location(SupPid, 1, 0)
但是add_location总是返回错误..
{child,undefined,test_location,
{test_location,start_link,[1,0]},
permanent,brutal_kill,worker,
[zc_pickup_location]}}
任何想法为什么?
答案 0 :(得分:0)
我的错误 - test_location中的方法start_link返回了主管不理解的内容。