[erlang-questions] gen_statem next_event queue question

Kenneth Lakin kennethlakin@REDACTED
Sat Sep 10 06:58:21 CEST 2016


Okay, I've looked over the gen_statem documentation a few times and have
not found a way to do what I'm looking to do. Consider the following
(poorly described) scenario:

My gen_statem is a state_functions gen_statem that's in state 'one'.
It does some work, and then returns
{next_state, one, State, [{next_event, internal, e_one}, {next_event,
internal, e_two}]}

The intent here is that we immediately want to process event e_one, and
then immediately process event e_two.

So, state 'one' is called again with the event e_one.
It does some work and determines that it needs to work on e_three after
the pending event queue is drained. (That is, once e_two has been worked
on.) If I return
{next_state, one, State, [{next_event, internal, e_three}]}
then 'one' will next be called with the event e_three, right?

If that's right, then is there a way to add events to the tail of the
queue, rather than the head?

Thanks much in advance.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20160909/570e072f/attachment.bin>


More information about the erlang-questions mailing list