[erlang-questions] Gen_fsm : race condition with a next_state timeout of zero?

Andy Gooden andy.gooden@REDACTED
Wed Sep 25 02:23:18 CEST 2013

Hi All,
I have a gen_fsm, where upon completing the handling of a message in
state_A, I want to immediately transition into state_B... so I have state_A
evaluate to:  {next_state, state_B, State, Timeout = 0}.

In my code, this is the only way to transition into state_B, so I only have
state_B ( timeout, State ) -> ...

Is it possible, if other processes are sending my fsm messages, for me to
get a message in my queue while executing state_A code, but then have to
handle that message with state_B code?
ie  will the immediate transition to state_B via the Timeout = 0 trump any
messages that landed in the queue?

The reason I ask is that I see an error message that looks like state_B is
having to handle a message other than 'timeout', even though the only way
to get into state_B is from state_A with Timeout = 0.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20130924/e28a0954/attachment.htm>

More information about the erlang-questions mailing list