[erlang-questions] Erlang gen_fsm transition to a new state
Mazen Harake
mazen.harake@REDACTED
Tue May 24 11:44:56 CEST 2011
If you start a gen_fsm init() will be called
init() -> {ok, foo, undefined}.
Next message you send with send_event() to the gen_fsm will be handled by
foo()
foo(_, _) -> {next_state, bar, undefined}.
Next message will be handled by bar()
bar(_, _) -> {next_state, foo, undefined).
Next message will be handled by foo().
If you use sync_send_event() instead then these functions must be of arity 3
since you get a "From" variable with them.
so, yes you can mix them but they are called differently.
And don't use a sync_send_event() from inside a callback function because
you will deadlock.
/M
On 24 May 2011 10:45, Alexander Kuleshov <kuleshovmail@REDACTED> wrote:
> Can i have any state_name/3 || /2 functions with different names?
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20110524/29d8de5d/attachment.htm>
More information about the erlang-questions
mailing list