<div dir="ltr">Hi!i!<br><div><div class="gmail_extra"><br><div class="gmail_quote">2016-09-10 6:58 GMT+02:00 Kenneth Lakin <span dir="ltr"><<a href="mailto:kennethlakin@gmail.com" target="_blank">kennethlakin@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Okay, I've looked over the gen_statem documentation a few times and have<br>
not found a way to do what I'm looking to do. Consider the following<br>
(poorly described) scenario:<br>
<br>
My gen_statem is a state_functions gen_statem that's in state 'one'.<br>
It does some work, and then returns<br>
{next_state, one, State, [{next_event, internal, e_one}, {next_event,<br>
internal, e_two}]}<br>
<br>
The intent here is that we immediately want to process event e_one, and<br>
then immediately process event e_two.<br>
<br>
So, state 'one' is called again with the event e_one.<br>
It does some work and determines that it needs to work on e_three after<br>
the pending event queue is drained. (That is, once e_two has been worked<br>
on.) If I return<br>
{next_state, one, State, [{next_event, internal, e_three}]}<br>
then 'one' will next be called with the event e_three, right?<br>
<br>
If that's right, then is there a way to add events to the tail of the<br>
queue, rather than the head?<br>
<br>
Thanks much in advance.<br>
<br></blockquote><div><br>If you send an event to yourself (gen_statem:call/cast or !) it will end up last in in the queue. The next_event is to make  sure this event will be handled next, before other events that may have been received from outside of the gen_statem processes control during the handling  of the last event. It is very useful in some cases in others you might not be at all interested in having internal events.<br></div></div><div class="gmail_quote"><div><br></div><div>Regards Ingela Erlang OTP/Team - Ericsson AB<br></div><div><br><br><br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>______________________________<wbr>_________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" rel="noreferrer" target="_blank">http://erlang.org/mailman/<wbr>listinfo/erlang-questions</a><br>
<br></blockquote></div><br></div></div></div>