2
根據Erlang文檔,只要您傳遞進程的PID而不是子規範標識符,就可以使用supervisor:terminate_child函數和simple_one_for_one supervisors。但是,在實踐中,這似乎不適用於我,而是函數返回{error,simple_one_for_one}。這裏是我所看到的:Erlang simple_one_for_one supervisor terminate_child不工作
([email protected])9> supervisor:which_children(my_sup).
[{undefined,<0.544.0>,worker,[cf_server]}]
([email protected])10> P.
<0.544.0>
([email protected])11> supervisor:terminate_child(my_sup, P).
{error,simple_one_for_one}
我做錯了什麼,或者是Erlang文檔不準確?如果我不能用supervisor:terminate_child來停止進程,我應該改用exit(P,shutdown)嗎?
謝謝,這解釋了它,因爲我使用R13B03 :-) – Nick