[erlang-questions] gen_statem confusion

Vans S vans_163@REDACTED
Wed Jan 18 19:40:36 CET 2017


What is the correct way to have an event proc next in the queue before any
other events/actions are procced.  Meaning this event should come before
any send / cast / call that were inserted into the process mailbox WHILE the 
event was being handled.

The options seem to be returning a timeout of 0 or returning next_event.

It is confusing which one is correct to use to get the desired behavior.

Example:

handle_event(timeout, _, _, _) ->
    long_running_func(),
    %a proc sends to us send(self(), msg)
    {next_event, internal, next_state},
    %OR

    {next_state, next_state, no_data, 0}.

We want to proc the next_state event/timeout befor handing the msg msg we got
from a random process.



More information about the erlang-questions mailing list