[erlang-questions] gen_fsm internal transition
Szepes Tamás
tamas@REDACTED
Fri Jan 25 15:19:22 CET 2013
Thanks for suggestion, I modified my code accordingly.
Tamas
-----Original Message-----
From: Dmitry Kolesnikov [mailto:dmkolesnikov@REDACTED]
Sent: Thursday, January 24, 2013 11:38 PM
To: Szepes Tamás
Cc: erlang-questions@REDACTED
Subject: Re: [erlang-questions] gen_fsm internal transition
Hello,
In practice, this is a safe way to handle internal transition.
In theory, internal FSM transitions should be avoided.
I would make it like this
state_name0(Event, From, State) ->
my_action_1(
my_action_0(State)
);
state_name1(Event, From State) ->
my_action1(State);
my_action_0(State) ->
% here goes code from you state_name
my_action_1(State) ->
% here goes code from your state_name1
- Dmitry
On Jan 24, 2013, at 7:14 PM, Szepes Tamás <tamas@REDACTED> wrote:
> All,
>
> What is the right way of doing an internal state transition in a gen_fsm?
>
> Is the following pattern safe to use?
>
> state_name(Event, From, State) ->
> .
> .
> .
> gen_fsm:send_event_after(0, internal_transition),
> {next_state, state_name1, State}.
>
> state_name1(internal_transition, From, State) ->
> .
> .
> .
> {reply, ok, state_name1, State}.
>
> Thanks,
> Tamas
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
More information about the erlang-questions
mailing list