Get gen_fsm PID

219 views Asked by At

I start gen_fsm:

start_link() ->
     gen_fsm:start_link({global, ?MODULE}, [],
                   []).

How can i get it's PID?

Thank you.

2

There are 2 answers

0
Adam Lindberg On

If you check the documentation for gen_fsm:start_link/3 you'll see that it returns {ok, Pid}.

0
user601836 On

You can either get it as the result of gen_fsm:start_link/3 or since it is a registered process using whereis(nameofprocess).