[erlang-questions] gen_statem confusion

Vans S <>
Wed Jan 18 23:03:45 CET 2017

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, ..}

On Wednesday, January 18, 2017 3:48 PM, Fred Hebert <> wrote:
On 01/18, Kenneth Lakin wrote:
>You need to be a little careful with this. next_event is a _stack_, not
>a queue. [...] It's really easy to overlook this. This subtle quirk was 
>the cause of at least one bug in a _widely_ used library.

Specifically I copied the terminology from the docs at 
http://erlang.org/doc/man/gen_statem.html#type-action :

> The stored events are inserted in the queue as the next to process 
> before any already queued events. The order of these stored events is 
> preserved, so the first next_event in the containing list becomes the 
> first to process. 

I guess that could use some rewording.

erlang-questions mailing list


More information about the erlang-questions mailing list