Multiple behaviour processes
casper2000a@REDACTED
casper2000a@REDACTED
Fri Jan 7 02:24:10 CET 2005
Yoel,
The problem here is when you use gen_fsm:start_link/4, you give a Name to your FSM instance and
it will get registered locally or globally by that name. When you have that, you cannt create another
instance with the same name, depending on local or global registration, locally or globally.
Instead you can use gen_fsm:start_link/3, by which you don't give a name to your instance. And you
will have to use the PID it returned to send_events. The gen_fsm:send_event/2 accepts Pid as
FsmRef.
Anyway what Vance has sent should be the most effective way to create multiple behaviours. I
advice you to study his method, because I'm also a newbie like you.
Cheers,
Eranga
Quoting Yoel Jacobsen : > Hello,
How can I create multiple behaviour (for instance gen_fsm) processes? I
have two issues I couldn\'t figure out:
1. When I start the second one I am getting an error:
59> test_fsm:start().
{ok,<0.140.0>}
60> test_fsm:start().
{error,{already_started,<0.140.0>}}
2. As far as I understand, the only way to notify an FSM is to use the
gen_fsm:send_event function. I don\'t see a way to send an event to a
specific instance of my fsm (Pid ! Msg doesn\'t work of cource).
Thanks,
Yoel
--------------This mail sent through OmniBIS.com--------------
More information about the erlang-questions
mailing list