2016-07-24 6 views
0

は私が監督:start_childは子を返し、未定義

{_, SupPid} = test_sup:start_link(). 
{Success, LocRef} = test_sup:add_location(SupPid, 1, 0) 

....呼んしかしadd_locationは常にエラーを返すます。.. 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]}. 

を呼び出すときに問題に実行されているように見えます

{child,undefined,test_location, 
      {test_location,start_link,[1,0]}, 
      permanent,brutal_kill,worker, 
      [zc_pickup_location]}} 

なぜでしょうか?

答えて

0

マイエラー - test_locationのstart_linkメソッドが、スーパーバイザーが理解できなかった何かを返していました。