[erlang-questions] gen_statem confusion

Fred Hebert <>
Thu Jan 19 01:27:43 CET 2017


On 01/18, Vans S wrote:
>Would using a timeout or state_timeout of 0 provide the same guarantees as using next_event?
>Looking at the API it seems state_timeout maybe just shortform for {next_event, state_timeout, ..}
>
No.

A regular timeout would not trigger if messages are received or waiting 
in the mailbox

A next_event timeout works as follows according to the docs.

>  If the value is 0 no timer is actually started, instead the the 
>  time-out event is enqueued to ensure that it gets processed before 
>  any not yet received external event.

Already received external events and enqueued next_events will likely 
run before state timeouts.


More information about the erlang-questions mailing list