通过supervisor terminate进程
<pre>
Fun = fun({,Pid,,_}) -> supervisor:terminate_child(player_sup,Pid) end.
lists:map(Fun,supervisor:which_children(player_sup)).
</pre>
检测解散的工会
<pre>
Fun1 = fun({Name,Pid,,}) -> IsLive = (Pid == undefined)end.
lists:filter(Fun1,supervisor:which_children(guild_sup)).
</pre>
检测活着的工会数量
<pre>
Fun2 = fun({Name,Pid,,},Sum) -> IsPid = is_pid(Pid),if IsPid -> IsAlive = is_process_alive(Pid),if IsAlive -> Sum + 1;true -> Sum end;true -> Sum end end.
lists:foldl(Fun2,0,supervisor:which_children(guild_sup)).
</pre>