[erlang-questions] gen_statem next_event queue question

Kenneth Lakin <>
Mon Sep 12 13:23:10 CEST 2016


On 09/12/2016 03:07 AM, Ingela Andin wrote:
> If you send an event to yourself (gen_statem:call/cast or !) it will end up
> last in in the queue.

Sorry, I should have been more clear in my initial message.

It seems to me that -conceptually- gen_statem has three queues:

* The next_event queue (which actually seems to behave like a stack)
* The "postpone" queue (which -I think- gets put at the front of the
next_event queue (but _after_ any {next_event...} actions passed along
in the state transition tuple) on state machine state change)
* The regular process mailbox

Is this wildly incorrect?

If my understanding is correct, then call/cast/! will put the message at
the tail of the process mailbox, yes? Additionally, does gen_statem
provide the tools to put a message at the tail of the next_event queue,
rather than the head? Or are we only provided with the means to add
events to the head of the next_event queue?

Thanks!

-------------- 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/20160912/67fecb8f/attachment.bin>


More information about the erlang-questions mailing list