Skip to content

Instantly share code, notes, and snippets.

@archaelus
Created December 19, 2008 18:04
Show Gist options
  • Save archaelus/38065 to your computer and use it in GitHub Desktop.
Save archaelus/38065 to your computer and use it in GitHub Desktop.
FindProcs = fun (Pid, Ign) ->
A = fun (F, Pid, Ignore) ->
Links = [P || P <- element(2, process_info(Pid, links)), is_pid(P), node(P) =:= node()],
Monitors = [P || {_, P} <- element(2,process_info(Pid, monitors)), is_pid(P), node(P) =:= node()],
New = lists:filter(fun (I) -> not lists:member(I, Ignore) end, Links++Monitors),
[Pid | lists:flatmap(fun (P) -> F(F, P, New ++ Ignore) end, New)]
end,
A(A, Pid, Ign)
end.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment